1

I have recently taken a position as an application developer and without much experience I am unable to determine the root of my problem. I have searched through the forums and have not be able to draw a conclusive answer to my specific problem, therefore I am asking a question. My apologies beforehand if I offend anyone or break any rules as I am new to this site.

I have several applications that require the use of oracle.dataaccess.dll. I have installed the oracle client x32 as requested by my employer. When I attempt to run any applications that require the oracle.dataaccess.dll file, I am met with varying errors.

Most application use the 4.xx.xx.xx version of the dll, which does not appear for my oracle client (I assume its because I installed the 32bit). When I attempt to use the 32 bit version I get various errors:

  1. The provider is not compatible with the version of Oracle client

or

  1. Could not load file or assembly. 'Oracle.DataAccess.dll' or one of its dependancies. An attempt was made to load a program w/ an incorrect format.

or

  1. The provider may not be installed.

If I attempt to use the oracle.dataaccess.dll that is used on the production servers, I get the same errors.

  1. What is the 'provider' and how can I figure out which one(s) I have installed?

  2. Should I have any of these dlls stored in my GAC?

  3. I have absolutely no idea where I need to go from here as I have tried everything that I know. I even uninstalled my Oracle Client and reinstalled to no avail. Please, any information that would point me towards a good tutorial or how to use oracle.dataaccess would be much appreciated.

Again I apologize beforehand for any trouble.

John Haynes
  • 13
  • 1
  • 3
  • I had this same problem and depending on if this is a windows or web application.. you need to change the properties at the project level to build the application as `x86` do not use the `x64` it will not work.. normally it should work with the build being set to AnyCpu. but Oracle's 64 bit Client has major issues so we went with the stable 32bit Client and it works like a charm do not store these in the GAC.. add the using statement to the header of the .cs file as well as manually adding the reference to the project – MethodMan Feb 19 '16 at 22:27
  • Once you add it to the project go to the dll and change the `CopyLocal=false;l property to CopyLocal=true` – MethodMan Feb 19 '16 at 22:28
  • Please check these answers: http://stackoverflow.com/questions/659341/the-provider-is-not-compatible-with-the-version-of-oracle-client#25412992 – Wernfried Domscheit Feb 20 '16 at 15:20

1 Answers1

4

Some generic points:

  • ODP.NET (i.e. Oracle.DataAccess.dll) requires an Oracle Client installation. The stand-alone DLL does not work.
  • The architecture (i.e. 32 vs. 64 bit) of Oracle.DataAccess.dll must match the architecture of the installed Oracle Client and the architecture of your application.
  • The version (e.g. 2.x or 4.x of Oracle.DataAccess.dll) must match the .NET compile target of your application. If you compile on target 2.0, 3.0 or 3.5 you must install version 2.x. For compile target 4 or above you must install version 4.x
  • The version (e.g. x.111, x.112, x.121, etc.) should match the version of installed Oracle Client.

Regarding your questions:

The provider is the DLL Oracle.DataAccess.dll. It can be a local copy in your application binary folder or installed in GAC.

It does not matter whether you use the GAC or not. Personally I prefer to use the GAC but you can also provide a local copy. The files in GAC takes precedence over the local file (see How the Runtime Locates Assemblies if you like to know all the detail about it)

You can interrogate the installed providers with gacutil.exe tool:

C:\>gacutil /l Oracle.DataAccess
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.18020
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:
  Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
  Oracle.DataAccess, Version=2.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
  Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86
  Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86
  Oracle.DataAccess, Version=2.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86
  Oracle.DataAccess, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
  Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
  Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86

Number of items = 8

C:\>
Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • I want to also mention that I appreciate you pointing me to one of your previous posts. Thank you very much for your help Wernfried! – John Haynes Feb 22 '16 at 16:21
  • When I installed my 32-bit client (as per my employer) I navigated to the "client_1\odp.net\bin" folder but I do not see a 4.x folder, only 2.x. I need to use the 4.x dll, as I compile on a target framework of 4.x for all the applications, but I am not exactly sure how find it if it wasn't installed with my client. Any advice? Thanks in advance. – John Haynes Feb 22 '16 at 16:39
  • Which Oracle version did you install? ODP.NET 4.x (32-bit) was introduced by Oracle version 11.2.0.1.2, see http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html. Check the installer options or install version 4.x manually. – Wernfried Domscheit Feb 22 '16 at 16:46
  • I installed the 11gR2 client. If I need to install manually, how would I go about that? I really appreciate all of your feedback. – John Haynes Feb 22 '16 at 16:51
  • Download a "XCopy" version from here: http://www.oracle.com/technetwork/database/windows/downloads/utilsoft-087491.html. Install command is like `install.bat ODP.NET4 C:\oracle\product\11.2\Client_x86 OraClient11g_home1` – Wernfried Domscheit Feb 22 '16 at 16:54
  • Ok, so I downloaded the XCopy and ran the install command. Now I have a problem with my TNSNAMES.ora file. I had it in the Network/Admin folder under Client_1. Is there somewhere else I need to move it to? or should it remain in that location? – John Haynes Feb 22 '16 at 19:38
  • It's up to you. Set environment variable `TNS_ADMIN` or/and set registry key `HKLM\SOFTWARE\ORACLE\KEY_{ORACLE_HOME_NAME}\TNS_ADMIN`. See also http://stackoverflow.com/questions/28280883/determining-locatation-of-relevant-tnsnames-ora-file/28283924#28283924 – Wernfried Domscheit Feb 22 '16 at 20:34
  • Hmm. So far, I've had no issues at all using the 2.122.1.0 dll on a PC where the installed Oracle client is v11, even though the "122" refers to v12.2 – Nyerguds Dec 02 '21 at 11:10
  • @Nyerguds are you sure? Check with [Process Monitor](https://learn.microsoft.com/en-us/sysinternals/downloads/procmon) which files are actually loaded. Or try my tool from https://github.com/Wernfried/connection-tester Anyway, there might be some version combination which work anyway. In general it behaves very sensitive in terms of versions. – Wernfried Domscheit Dec 02 '21 at 11:22
  • Hmm, no, you're right. I had some setting wrong, and it wasn't actually using the class that uses `Oracle.DataAccess.dll`. Once I made it use it, it indeed complained about not finding some Oracle 12 specific dll. – Nyerguds Dec 02 '21 at 11:56