3
votes

I'm a junior .net developer.I have developed a simple client application (.net3.5) which needs to gets its results from the 10g oracle database server. This application is to be deployed in 100 32-bit systems who do not have oracle installed but they have access to the server.We don't intend the users to have oracle installed in their machine. Is that possible? I followed http://www.splinter.com.au/using-the-new-odpnet-to-access-oracle-from-c/ whatever is said in this link,and it generates the version mismatch error mentioned in the bottom of the link. Does it work without having oracle client in the user's machine, cos it is working fine in my machine as it has oracle installed.Is there any other way to work around this?

My connectiopn string is :

OracleConnection conn = new OracleConnection();
conn.ConnectionString = "User ID=<userid>;Password=*******;Data Source=<data source>";
conn.Open();".

Exception generated is:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. ---> Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client
   at Oracle.DataAccess.Client.OracleInit.Initialize()
   at Oracle.DataAccess.Client.OracleConnection..cctor()
   --- End of inner exception stack trace ---
   at Oracle.DataAccess.Client.OracleConnection..ctor()
   at WindowsFormsApplication1.frmVoiceFileMover2.cmdGetId_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.269 (RTMGDR.030319-2600)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
VoiceFileMover2
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files/State%20of%20Maine/VFM2Setup/VoiceFileMover2.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.278 built by: RTMGDR
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.282 built by: RTMGDR
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.269 built by: RTMGDR
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
Oracle.DataAccess
    Assembly Version: 2.111.6.20
    Win32 Version: 2.111.6.20
    CodeBase: file:///C:/Program%20Files/State%20of%20Maine/VFM2Setup/Oracle.DataAccess.DLL
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.237 (RTMGDR.030319-2300)
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.233 built by: RTMGDR
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Transactions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.233 built by: RTMGDR
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

I have 2 oracle clients 10.2 and 11.2 installed in the developing machine. I referenced oracle.dataaccess.dll to my project from the 11.2 client and then later when it was not working, i downloaded the latest release of odp.net and referenced again.When i still see this exception, I tried to work with odp.net for 10g as well but i could not find oracle.dataaccess.dll in the 10g.Is this issue because of GAC?

I have also tried to work with ODP.net managed driver beta according to this link "http://www.youtube.com/watch?v=I1q50HnUh_w".

Do i have to install oracle client in every machine. Can't i package the required dlls in the project and make it work? If instant oracle slient makes it work, how do i proceed to work with instant client. My only hope currently is to find if there is a file oracle.dataaccess.dll in 10g odp.net so that it matches the oracle version in the server, inorder to make it work. If not how can i use oracle instant client? Any help is highly appreciated.

1

1 Answers

2
votes

I do not believe you can achieve what you want without installing the Oracle Instant Client on each of your clients machines atleast not if you are using ODP.net the recommended way. The link that you have mentioned in your question that you are following is a hack and while it may work, it is not the Oracle recommended way of usage. However, having said that, if you can make it work, that will probably be your best case short term scenario. Though i am afraid, i can be not much help to you there.

In my knowledge, All ODP.net versions for .NET3.5 are unmanaged and need the installation of Oracle Instant Client for them to work.

The only way that I am aware of using that unmanaged provider and still making it work without client installs would be by making a layered application where your DAL resides on the server and not on the client thus giving you control to install the Oracle Instant Client only on the server.

Note : There is a managed ODP.net provider released recently but AFAIK, that will only work with .NET 4.5 (maybe 4 but definitely not with .NET 3.5)