Oracle OleDB error Attempt to load Oracle client libraries threw BadImageFormatException

Posted on 2011-10-26
Last Modified: 2012-05-12
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.
Question by:NillumbikSC
    LVL 76

    Expert Comment

    by: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.

    Author Comment

    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.
    LVL 76

    Accepted Solution

    Sorry for the delay in responding.  Got tied up this week.

    Is this a .Net app?

    Here is a reference that talks about web apps being affected by a 'bad' install and how to verify the driver is working.

    Author Comment

    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.

    Author Closing Comment

    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.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
    Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now