0

The error of the 'Oracle provider which is not compatible with the version of Oracle' has been asked a couple of time on stackoverflow already, but seemingly all answers are either directed at x86 vs 64 bit or missing DLL's.

I'm not sure if this situation in unique, but...

I have a web project, win project and a project with some shared code. Now all 3 projects are set to 'Any CPU'. The win project can connect to Oracle, but the Web projects gives the error

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

Both the web and win projects have the same DLL's in their bin folders.

Why can the one connect, but not the other? What else can I try? (I've also tried the other platform targets).

The error occurs when running:

OracleConnection oc = new OracleConnection(ConnectionString);

EDIT: The connection string are compiled from the Shared project, by reading credentials out of a SQL database, so the Win and web conn strings are the same. Here is a sample:

User Id=xxx;Password=xxx;
Data Source=(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)
(HOST=172.xx.xx.xx)
(PORT=1521))
(CONNECT_DATA=(SID=xxx)));
Cameron Castillo
  • 2,551
  • 7
  • 40
  • 65
  • Do you share the ConnectionString between web and win projects? Can you show us the connection strings for each (credentials redacted is fine) – mjw Aug 25 '15 at 19:51
  • I've updated my post. See Edit block. – Cameron Castillo Aug 27 '15 at 07:40
  • Are you sure your web reference to Oracle.DataAccess points to the same .dll? We use a SharedBinaries folder for our solutions that have multiple projects to avoid possible conflicts, but you still need to be sure the actual project references are pointing to the correct binaries. – mjw Aug 27 '15 at 13:03
  • Well, it is different files, but the same version number on both of them. – Cameron Castillo Aug 27 '15 at 16:46
  • Can you, for argument's sake, change the reference in the web project to point to the working .dll in the win project? That should tell you pretty quickly where your issue resides. – mjw Aug 27 '15 at 17:34
  • Thanks mjw. But no sorry, they are referencing the same file now, but the same thing happens. Only partly working. Will keep on trying different things. – Cameron Castillo Aug 28 '15 at 05:39
  • There are a couple of suggestions in here. Maybe you've already seen this thread? http://stackoverflow.com/questions/659341/the-provider-is-not-compatible-with-the-version-of-oracle-client – mjw Aug 28 '15 at 12:49
  • Yes, I've seen that thread before and used it many times before. It was most helpful before, but in this case it did not provide me answers. – Cameron Castillo Aug 31 '15 at 07:53

2 Answers2

0

I had the same issue, and it turns out that when you run web projects in local, the iis express by default use 32 bit as standard, while your other projects may use 64 bit version dll, that's why they behave differently, you can enable your iis express to use 64 bit version, or you can choose to install a 32 bit version ODAC

LIU YUE
  • 865
  • 8
  • 10
-1

This happens when your oracle db version is different from the oracleOracle.DataAccess.dll you are using, check the versions if that is the case then you need to use the oracleOracle.DataAccess.dll of the correct version.After getting correct version dll you need to change the reference of oracleOracle.DataAccess.dll in all your projects.(encountered similar situation while migrating from 10g to 11g).

Kryptonian
  • 822
  • 3
  • 10
  • 20
  • 2
    This is incorrect. It is not an issue to connect to an 11g database using the 10.2 client. – mjw Aug 27 '15 at 13:06