Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 349
SoftwareSavant Avatar asked Nov 29 '11 16:11

SoftwareSavant


2 Answers

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

like image 111
CodingWithSpike Avatar answered Sep 19 '22 04:09

CodingWithSpike


This worked for me once i ran them:

OraProvCfg /action:config /product:odp /frameworkversion:v2.0.50727 /providerpath:C:\app\Administrator\product\11.2.0\client_1\ODP.NET\bin\2.x\Oracle.DataAccess.dll

OraProvCfg /action:config /product:odp /frameworkversion:v4.0.30319 /providerpath:C:\app\Administrator\product\11.2.0\client_1\ODP.NET\bin\4\Oracle.DataAccess.dll

Good luck

like image 44
Elie Avatar answered Sep 20 '22 04:09

Elie