2011-01-14

Windows x64 knowledge

I have learned about Windows 64-bit:

  • On a 64-bit Windows machine, there are two different locations for programs to be installed:
    • Programs
      • For 64-bit programs
    • Programs (x86)
      • For 32-bit programs
  • There are two different ODBC managers:
    • the 64-bit version is accessed from Control Panel / Administrative Tools
    • the 32-bit version may be found under [SysDrive]:\Windows\SysWOW64
  • Oracle 10g had a problem with the parentheses in the “Programs (x86)” folder name, for which there were released a patch.
  • The BI Development Studio (VS2008) which comes with SQL Server 2008 is 32-bit, and does not have easy access to 64-bit drivers. This goes also for the SSIS Package Designer.
    • If you build for “Any CPU” it might still work.
    • Or you could install both, and define ODBC connections with the same names using both of the ODBC managers.
  • (more info coming soon…. maybe)

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).