tags:

views:

13735

answers:

9

I'm trying to use the Oracle ODP.NET 11g (11.1.0.6.20) Instant Client on my ASP.net project as a Data Provider but when I run the aspx page I get a "The provider is not compatible with the version of Oracle client" error message. Any help would be appreciated.

I've referenced the Data Provider in Visual Studio 2005 and the code behind looks like this:

using Oracle.DataAccess.Client;
..

OracleConnection oOracleConn = new OracleConnection();
oOracleConn.ConnectionString =
    "Data Source=MyOracleServerName;" +
    "Integrated Security=SSPI";
oOracleConn.Open();

//Do Something

oOracleConn.Close();

The error for the page looks like this:

Exception Details: Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client

Source Error: 
Line 21: 
Line 22: 
Line 23:             OracleConnection oOracleConn = new OracleConnection();
Line 24:             oOracleConn.ConnectionString =
Line 25:                 "Data Source=MyOracleServerName;" +

[OracleException (0x80004005): The provider is not compatible with the version of Oracle client]
   Oracle.DataAccess.Client.OracleInit.Initialize() +494
   Oracle.DataAccess.Client.OracleConnection..cctor() +483

Stack Trace: 
[TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception.]
   Oracle.DataAccess.Client.OracleConnection..ctor() +0
   Boeing.IVX.Web.RoyTesting.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\CE218C\Desktop\IVX.Net\Web\IVX\RoyTesting.aspx.cs:23
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
A: 

Does the IIS/IWAM user have permissions on the Oracle directory? Can you connect to this data source using another app, such as Excel or Access?

DCookie
+1  A: 

It would seem to me that though you have ODP with the Oracle Istant Client, the ODP may be trying to use the actual Oracle Client instead. Do you have a standard Oracle client installed on the machine as well? I recall Oracle being quite picky about when it came to multiple clients on the same machine.

Peter Meyer
+6  A: 

I only installed the Oracle Data Provider for .NET 2.0 (11.1.0.6.20) and I did not install the Oracle Instant Client (11.1.0.6.0). I just installed it and the error disappeared!

Thanks for all the help

Roy
Great! I thought it smelled an awfully lot like the the underlying client was missing. Haven't worked with Oracle in a while, but I remember this types of issues constantly.
Peter Meyer
Thanks for taking the time to look at this Peter.
Roy
Can you simply copy the 4 instant client DLL's into the same folder as your EXE, instead of installing the client? (these files: oci.dllorannzsbb11.dlloraocci11.dlloraociicus11.dll)
Chris
+1  A: 

I'm having the same issue - I have deployed a WPF application using ClickOnce. The manifest is deploying the 4 necessary Instant Client DLLs along with my application files/executables.

When the app runs i get a XamlParseException on InitializeComponent(), and on looking deeper, the root inner exception is the OracleException mentioned above:

"The provider is not compatible with the version of Oracle client"

  1. I am using ODP.Net Oracle.DataAccess.dll ver. 2.111.6.20
  2. I am using Oracle Instant Client 11.1.0.7
    • oci.dll
    • orannzsbb11.dll
    • oraocci11.dll
    • oraociicus11.dll

www.oracle.com/technology/oramag/oracle/08-nov/o68odpnet.html - this site shows how to install the instant client... its suggestion is to a neutral folder via xcopy, and then sticking the folder in the PATH variable...

The only thing I've done different is added the dlls to my project as "content" "copy local always" so that they are deployed via ClickOnce properly, and should not need a PATH statement to be found and used.

Any thoughts? I'm stuck.

Any news trying to get it working using your method? I'm trying similarly, because i don't want to have to install the full client, i just want to have the 4 instant client dll's in the same folder as my EXE, like you.
Chris
+1  A: 

This can be caused by running a 64bit .NET runtime against a 32bit Oracle client. This can happen if your server you are running the app on it 64 bit. It will run the .NET app with the 64bit runtime. You can set the CPU flag on your project in VS to run in the 32bit runtime.

Daniel
+1 - this is easily overlooked
Ed Guiness
A: 

I had the exact same problem. I deleted (and forgot that I had deleted) oraociei11.dll after compiling the application. And it was giving this error while trying to execute. So when it cant find the dll that oraociei11.dll, it shows this error. There may be other cases when it gives this error, but this seems to be one of them.

+2  A: 

I've been looking into this problem further, and you simply need to grab all the appropriate DLL's from the same downloaded version of ODP.Net and put them in the same folder as your Exe file, because ODP.Net is fussy about not mixing version numbers.

I've explained how to do this here: http://splinter.com.au/blog/?p=156

Here's the gist of it though:

Chris
A: 

install ODP.Net on the target machine and it should solve the issue... copying the dll's does not look a good idea...

HainKurt
A: 

I'm having the exact same exception, but INTERMITTENTLY. I get a stack trace, I reload, and it reloads just fine.

[OracleException: The provider is not compatible with the version of Oracle client]
   Oracle.DataAccess.Client.OracleInit.Initialize() +288
   Oracle.DataAccess.Client.OracleDataAdapter..ctor() +28
[...]
[ConfigurationException: 
- The error occurred while loading Providers.
- initialize provider  
- Check the oracle10.1.]
   IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean isCallFromDao) +314
   IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Configure(Stream resource) +29
   Ith.Instance.DataAccess.Common.Strategy.CustomDataMapperStrategy..ctor(NameValueCollection properties) +178
Sytse