Link to home
Start Free TrialLog in
Avatar of NillumbikSC
NillumbikSCFlag for Australia

asked on

Oracle OleDB error Attempt to load Oracle client libraries threw BadImageFormatException

We have an application that communicates with an Oracle database and uses a MS SQL database to manage the data and present it to a web page. The issue is that whenever we access a page that requires data from SQL via a linked server connected by the OraOLEDB.Oracle provider an error is thrown. "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". This seems strange in that all the drivers have been loaded using the 64bit installation from Oracle for the complete Client (Administrator Tools option).
The Linked server on SQL 2008 R2 enable us to run queries successfully on the Oracle 11gR2 database.
All servers are W2008R2 64 bit (Web, Oracle 11gR2 and MS SQL2008R2)
Any suggestions for fixing this error?
We have tried installing the Oracle 32 bit Client but this does not seem to make any difference.
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Something is trying to mix and match drivers.  Tripple check you installed the Oracle 64Bit client.

If you need the 32Bit Oracle drivers:  When you installed the 32Bit Oracle Client did you make sure the app and environment was pointing to it first?

Oracle has a habit of mixing up things like PATH and other variables when mixing and matching different versions on the same machine.
Avatar of NillumbikSC

ASKER

Have double check and triple checked that the Oracle drivers 32 bit and 64 bit are installed and have swapped around the path so that 32 and 64 bit have both been at the fron and still the problem persists. I have alos installed ODAC on a third home to see if that woul help but still no joy.
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

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
Thanks for your help slightwv the UDL check went fine but the solution was actually the Alternative 2 suggestion which I applied to the Web Application Pool running this app and bingo the error "bad Image" has gone. Thanks for your assist in getting a really long and tedious problem resolved. Should have posted this problem earlier.

The other option to review when you receive this error is to view your Application_Pools setting for the app_pool you are using for your application.
 
Check the "Enable 32-Bit Applications". If this is "False", change it to "True". This may resolve your issue.
Yet again the value of the EE world comes through. I had battled with this problem for about 2 weeks off and on and finally a solution. Many thanks guys and gals.

BTW the solution was actually the setting in the web application pool by setting "Enable 32-Bit Applications" (Advanced settings) to false ths forcing the 64 bit conversation.