Run Oracle Client in 32-bit mode on a 64-bit machine

61,991

Solution 1

I found that you have to install the 32-bit Oracle client (you can download the installer from their website) even if you are running on a 64-bit machine.

In addition, during the discussions people were talking about 32-bit mode etc. This is how you can check / set that for an IIS 7 hosted application. You shouldn't need to change this but I have added here for completeness / future reference.

  • Launch IIS 7 and expand the server name node.
  • Click on Application Pools node and find the application Pool you are using.
  • On the right-hand panel click Advanced Settings...
  • In the pop-up box that appears check Enabled 32-Bit Applications setting which is third option from the top.

Solution 2

You have to change your main .exe file to run only as 32-bit. You can do this in Visual Studio - just change Platform target from "Any CPU" to "x86".

If this is not possible, use corflags.exe which forces an existing exe to be a 32-bit application.

Solution 3

I have been struggling with this issue for months now and finally solved it. I think all the posts are helpful, but I had one missing piece. I didn't have a Microsoft ODBC for Oracle instance setup for User DSN or System DSN. I'm working on a Windows 8 machine. So for me I had to go to the general windows search and type in ODBC and open the ODBC Data Source Administrator (32-bit). Check to see if you have a Microsoft ODBC for Oracle setup on the User DSN tab or the System DSN tab. If not click on Add and select Microsoft ODBC for Oracle. Fill out the info for your datasource you are trying to hit and click ok. Make sure to restart your computer and that is what finally worked for me. Hope this helps some of you.

Solution 4

You have to change your main .exe file to run only as 32-bit. You can do this in Visual Studio - just change Platform target from "Any CPU" to "x86". https://msdn.microsoft.com/en-us/library/ms185328.aspx

Share:
61,991
Joseph
Author by

Joseph

SOreadytohelp

Updated on February 21, 2020

Comments

  • Joseph
    Joseph about 4 years

    I have just moved from a 32-bit Windows 7 desktop to a 64-bit Windows 7 Laptop. We have a C# program that we are developing that contains approximately 60 projects within the solution. I keep getting the following error whilst trying to build:

    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
    

    Obviously the error is quite self explanatory and I am trying to get my whole solution to load in 32 bit mode. I have gone through every single project and set the target platform to x86 but I am still getting this error. I have searched Google and seen countless different approaches, but I cant seem to fix this problem. What is the best way to ensure my project is running in 32-bit mode on a 64-bit machine?

    I am using Visual Studio 2008. I am currently considering downgrading to 32-bit but really want to avoid having to do this.

  • Joseph
    Joseph about 11 years
    I don't have x86 in the drop down in the toolbar, so I guess I'll have to use corflags.exe. From the page you kindly linked me to, I assume I need to run "CorFlags.exe assembly /32BIT+" What exactly is the assembly value? Thanks.
  • Piotr Stapp
    Piotr Stapp about 11 years
    assembly - your exe file. In visual studio click right your project, choose properties. select Build tab and on it you have Platform target. In this combo you have Any CPU, x86, x64
  • Piotr Stapp
    Piotr Stapp about 11 years
    I just read in comments that you are using web application. You can set this in IIS: help.webcontrolcenter.com/KB/a1114/…
  • Joseph
    Joseph about 11 years
    I'm using the build in ASP.NET Development Server within Visual Studio. How would I set it in this?
  • Piotr Stapp
    Piotr Stapp about 11 years
  • Joseph
    Joseph about 11 years
    I had a look at that yesterday but I couldn't find any answers on that page unfortunately. The way I read it,is that the process is running in 32 bits? In which case, why am I getting the above error?
  • Piotr Stapp
    Piotr Stapp about 11 years
    Just change WebDev to IISExpress or IIS.