Solution for 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.
Know how to fix below error when Connecting applications to Oracle Client database:
InvalidOperationException: 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. BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
Step 1: Install 64 bit version of Oracle Client at specific location e.g. C:\oracle\product\11.2.0\client_x64\
Step 2: Install 32 bit version of Oracle Client at specific location e.g. C:\oracle\product\11.2.0\client_x86\
OR copy installed 32 bit version of Oracle Client at the location mentioned above.
Step 3: Create a link to 64 bit installed version in "C:\WINDOWS\System32" by using following mklink command:
3.1. Open Command Prompt in Administrator mode
3.2. Go to C:\WINDOWS\System32 and type following command:
mklink /D ora112 C:\oracle\product\11.2.0\client_x64
Above link will create symbolic link for ora112, so if you visit C:\WINDOWS\System32 and double click on ora112 file, it will take you to C:\oracle\product\11.2.0\client_x64\ location.
Step 4: Now right click on My Computer icon, click on Properties.
Step 5: Click on "Advanced system settings" icon, it will open System Properties popup with "Advanced" tab as default selected.
Step 6: Click on "Environment Variables..." button,
Step 7: In the bottom "System variables" section, double click on "Path" System Variables
Step 8: Now click on "New" button in "Edit environment variable" popup window and add following paths in the same sequence written below:
Step 9: After adding all above paths, click on "OK" button and close the "Environment Variables" popup window
Step 10: Now try running your application again and check whether you are able to connect to Oracle Client Database.
All above steps should fix your Oracle Client Components connection issue with your application.