Link to home
Start Free TrialLog in
Avatar of brgdotnet
brgdotnetFlag for United States of America

asked on

I build my visual studo project against x86 and am getting BadImageFormatException

In Visual Studio I want to build an application to run as a 32 bit application running against an Oracle database.  Now, After I build and run the application against Oracle, I am getting the below error message. I verified that I have a 32 bit oracle driver installed by running odbcad32 and on the "Drivers" tab verifying that SQLORA32.dll is listed.

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

I need some expert help on why I am getting this error message when running against Oracle
Avatar of Dr. Klahn
Dr. Klahn

This problem will occur when running in 64 bit mode with the 32 bit client components installed.

Are you developing and testing on a 64-bit system?  Ship the executables to the 32-bit target system and test there.

When developing for 32-bit targets it is safest to use 32-bit development machines.  Same for 64-bit targets and 64-bit development machines.  Things can go wrong when trying to rely on Windows emulation mode for 32-bit applications.
I don't think you can just go by "32" in the files.

There are two ODBC admin tools on a 64Bit system.  Make sure you are running the 32Bit one:
https://support.microsoft.com/en-us/help/942976/odbc-administrator-tool-displays-both-the-32-bit-and-the-64-bit-user-d


That said:  Why are you using the ODBC drivers?  I would use a more native driver.  You mention Visual Studio and I think .Net.  I would strongly suggest the ODP.Net Managed Drivers.
ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial