Installing ODP.net on server to resolve Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client

SoftwareSavant picture SoftwareSavant · Nov 29, 2011 · Viewed 40.4k times · Source

I have a test environment for a service that my site will be using and a production environment. In my test environment I have ODP.net installed on the server. That service that uses Oracle seems to be running pretty smoothely so far. I don't appear to have an Oracle Client running on that server at all. On the other hand I have a server which has an Oracle client on it, but doesn't appear to have ODP.net installed on it (I am in the process of double checking, but that is the situation as of this S-O question). On the production server I get this exception:

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

in both servers I have the Oracle.DataAccess dll in the bin and lib folders (don't think I need it in the lib folder, but why rock the boat... I am sure you can come up with a good reason, but not right now!!!). My question is do I need to install ODP.net onto the production server? Has that resolved any issues that you have come across? I have seen some SO post that say this resolved a similar issue for them. Could you recommend a course of action? Thank you!

Answer

CodingWithSpike picture CodingWithSpike · Nov 29, 2011

There are a lot of little sub versions of the oracle client, and what likely happened is that the oracle clients installed on the machine giving the error isn't exactly the same version that the Oracle.DataAccess.dll file came from.

The best thing to do is make sure you use exactly the same install package on every dev machine and server. This will avoid any missmatch.

As an alternative, what I've done in the past to resolve this (and it may not be the "best" thing to do, but it usually works for me) is to also copy the file OraOps11.dll to your \bin directory, along with the Oracle.DataAccess.dll file.

Get the file from the same oracle install on the same machine where you got Oracle.DataAccess.dll. It should be in a folder named something like this, depending on where you installed Oracle, and what version:

C:\oracle\product\11.1.0\client_1\bin\OraOps11.dll