1
votes

My visual basic application is trying to connect to an Oracle database but exception error message keeps displaying,

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

screenshot

X

I installed Visual Studio Express Edition 64 bit and Oracle Express Edition 64 bit. Now I'm wondering why I'm getting this kind of error.

1
The .NET assembly that is containing the classes your program is using to talk to Oracle (through the drivers) is most likely 32-bit, and you have a 64-bit process, or vice versa (32-bit process, 64-bit assemblies). Have you checked if your program is compiled as 32-bit or 64-bit? What is the target? x64, x86, Any CPU? If the latter, there is a checkbox in the project settings for "prefer 32-bit", can you verify what this is configured to be? - Lasse V. Karlsen

1 Answers

0
votes

It is not clear why this error occurs. To work with Oracle database, use Oracle.ManagedDataAccess NuGet package and I also recommend you to tick "Prefer 32-bit" option in project properties. Using Windows integrated Oracle data provider (as in screenshot) is strongly not recommended - it is old and deprecated.