Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error using oracle.dataaccess.dll

I have a web application which uses Oracle.DataAccess.dll to communicate with an Oracle db. The web application deployed on 32 bit windows system works but not on windows server 2008 64 bit. I installed 10204_vista_win2k8_x64_production_db package, referenced the installed dll (version 2.102.4.0) from the project but I get the following error:

Could not load file or assembly 'Oracle.DataAccess, Version=2.102.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

like image 322
Zoliqa Avatar asked Jan 20 '10 11:01

Zoliqa


2 Answers

Same here. The Oracle.DataAccess assembly doesn't run in 64 bit mode.

You should set the application pool for your site to 32 bit mode (go to the application pool's Advanced Settings and set Allow 32 Bit Applications to "True")

If that doesn't work, make sure your Oracle directory (the directory containing all the Oracle dlls) is in your system path. If you forget that, you get the same cryptic error about not finding Oracle.DataAccess.

EDIT:

Installing the Oracle client can be a major pain. Using the Oracle Instant Client is somewhat easier than installing the full client, so this is what I usually do:

  1. Download the Oracle Instant Client
  2. Unzip the archive in c:\oracle (any other directory will do)
  3. Open a command prompt as administrator
  4. type cd \oracle
  5. type configure odp.net20 myhome
  6. Right-click on "My Computer", "Advanced System Settings", "Environment Variables" and add the C:\oracle directory to the system path
  7. Copy the Oracle.DataAccess.dll file from c:\oracle\odp.net\bin\2.x to your application's bin folder
  8. (optonally) edit your c:\oracle\tnsnames.ora file
like image 57
Philippe Leybaert Avatar answered Oct 18 '22 03:10

Philippe Leybaert


I'm going to give you the answers from what I've just went through on Windows Server 2008 R2 which is a 64 bit operating system. The application suite of libraries I was given were developed using .net 3.5 x86 with the older DLL libraries and I was stuck because I had installed the newer x64 clients from oracle.

What I found was the following: Install the latest x64 client from Oracle for Windows Server 2008. I believe this would be the 2.7.0 client. When you select the installation, make sure you do custom and select the .NET libraries. Configure your tnsnames files and test your tnsping against your data source.

Next, if you are running a 32 bit application, install the same version of the client for 32 bit. Also, follow the same installation routine, and select the same home.

When your finished, you will find that you have a single app/product with two client directories (Client1 and Client2).

if you navigate to the windows/assemblies directory you will find that you have a reference to the Oracle.DataAccess.dll (x2) with one for x86 and one for AMD64.

Now, depending on if you have developers or are developing on the machine yourself, you may be ok here, however, if they are using older drivers, then you need to perform one last step.

Navigate to the app\name\product\version\client_1\odp.net\publisher policy\2.x directory. Included in here are two policy files. use gacutil /i to install the Policy.2.111.Oracle.DataAccess.dll into the GAC. This will redirect legacy oracle ODP calls to the newer versions. So, if someone developed with the 10g client, it will now work with the 11 client.

If you need further details, or need other questions answered like flipping 32 bit mode on or off on your .net assemblies, email me.

J Banks [email protected]

Good luck.

like image 21
John Banks Avatar answered Oct 18 '22 02:10

John Banks