2011-01-14

64-bit Windows 2008 vs Oracle x64

Ok, so finally after exploring several ways to run a query on Oracle x64, I have succeeded.

First step is to install a 64-bit Oracle Client on the W2k8 server. For me it works with the Oracle 11g InstantClient v. 11.2, connecting to an Oracle 10.x.. database.

I am using a 32-bit developer machine, using the System.Data.OracleClient classes, and everything seems to work.

My connection string is like this:
<connectionStrings>
    <add name=”oracle” 
            connectionString=”Data Source=TNSNAME;UserId=uid;Password=pwd;” />
</connectionStrings>

So everything works nicely, until I move my compiled code to the x64 server.
I now get this error:

Attempt to load Oracle client libraries threw BadImageFormatException.  This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.

Solution:
Before compiling, go into the project properties and set the “Platform target” property to “Any CPU”.
Compile, then copy your assemblies to the server. Looks like an extra DLL-file has been added to my bin-folder (Oracle.DataAccess.dll).

No comments:

Post a Comment