Vigj
Vigj

Reputation: 81

64bit Oracle client for Delphi xe

How can I install a 64bit client for Delphi xe (which runs 32bit and has a 32bit client ) Can I run a 32bit client and 64 bit client together on the same machine?

I'm developing a 64bit application and so I need the 64 bit client

using the 32bit client I get

sourceException {"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."} System.Exception {System.InvalidOperationException}

Upvotes: 1

Views: 2647

Answers (4)

Robert Love
Robert Love

Reputation: 12581

I have seen this numerous times in my organization that since they installed a 64 Bit OS (Windows 7/Windows 2008 R2) they think they must install the 64 Bit Oracle Client.

The OS does not control this, the application does.

  • If your application is 32 bit it must use the 32 bit client.
  • If your application is 64 bit it must use the 64 bit client.

Delphi XE is a 32 bit application. It can only produce 32 Bit applications.

Update after you clarified your question.

  • You can have multiple Oracle Clients installed on a machine
  • Clients can be different versions or Bitness
  • Each Client must be installed into a different Oracle Home

The client application then needs to be smart enough to load the correct libraries. Typically the last client installed ends up on the system path. This typically is also the default home.

Applications load the OCI library (OCI.DLL) They typically do this with loadlibrary('oci.dll') which is going to find the version of the OCI.DLL on the system path.

I suspect that is what is happening that is causing your error.

loadlibrary can be called with full path name to specify which client to use. LoadLibrary('C:\app\oracle\product\11.2.0\client_1\bin\oci.dll')

By default Delphi uses the oracle home on the system search path.

Although I have never tried it you should be able specify the full version of the OCI.DLL in the dbxdrivers.ini file in Delphi to specify that actual oracle home you want to use.

Upvotes: 4

Bruce McGee
Bruce McGee

Reputation: 15334

From the error message, I think you're asking if both the 32 and 64 bit Oracle clients can coexist on the same machine.

Apparently, they can. I haven't done it myself, so you'll probably need to dig for some more details.

Upvotes: 2

LU RD
LU RD

Reputation: 34899

To call a 64 bit dll from a 32 bit application, see A.Bouchez's answer in this thread.

Upvotes: 1

Lars Truijens
Lars Truijens

Reputation: 43595

If by client you mean some x64 dll being loaded into Delphi's x86 applications you can not do that. You could if the client is some other process and by using some form of inter process communication.

So your options are:

  • Use FreePascal to build a x64 'delphi' client
  • Use Delphi Prism (Delphi for .Net) to build a (x64) .Net client in Delphi
  • Seprate both in different processes and use a form of inter process communication
  • Use the 32 bits version of the Oracle client
  • Use another 32 bits library to do what the Oracle client does

Upvotes: 1

Related Questions