添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I have designed a C# application to connect to Oracle Database and change schema users passwords. My reference assembly is System.Data.OracleClient from the location: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Data.OracleClient.dll"

The platform that I used to design/test the application looks like this: 1. 64 bit Windows 7 platform. 2. 32 bit .Net Frameworkv4.5 3. 32 bit Oracle 10g Client.

I need this application to run for 64 bit Oracle Client too. But when I transfer my binaries to a machine which has 64 bit Oracle 11g installed, I get this error: "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."

I am not sure how to work around this issue. Please suggest if I need to make any code changes or assembly reference. I read through a lot of similar forums but could not find anything helpful. Please help!

First of all, provider System.Data.OracleClient is deprecated. Microsoft is not supporting it anymore, you should consider to use the Oracle provider Oracle.DataAccess or Oracle.ManagedDataAccess .

My recommondation is to install both, 32-bit and 64-bit Oracle Client on your developing machine, then you can test and build anything. Here is an instruction how to do this: Install x86 and x64 Oracle Client on one machine

An x86 Oracle client can connect to a 64 bit Oracle Database, vice versa is also no problem.

devArt's dotConnect for Oracle will also work. It costs money, but it has no client dependencies (last time I used Oracle's ODP.net it puked if the client had no Oracle Client installed) and it also works with Entity Framework. Hambone Jun 19, 2014 at 16:33 Provider Oracle.ManagedDataAccess also does not need any Oracle Client installed. However, it was released recently in 12c and has still a few bugs. Wernfried Domscheit Jun 19, 2014 at 19:46

I had the same issue on a Windows 10 PC. I copied the project from my old computer to the new one, both 64 bits, and I installed the Oracle Client 64 bit on the new machine. I got the same error message, but after trying many solutions to no effect, what actually worked for me was this:

In your Visual Studio (mine is 2017) go to

Tools > Options > Projects and Solutions > Web Projects

On that page, check the option that says: Use the 64 bit version of IIS Express for Websites and Projects

  • Open Oracle Net Configuration Assistant
  • Select radio button option at Local Net Service Name Configuration, then click Next
  • Select radio button option at Reconfigure, then click next
  • Select net service name you want to reconfigure, either ORACLR_CONNECTION_DATA or ORCL, then click Next
  • input your Service Name, if your service name of installed oracle as ORCL, then write ORCL to the field, then click Next
  • select the protocol you want to use, for example, select TCP, then click Next
  • input hostname where your oracle database engine (service) installed, for example, installed on your desktop or notebook, then fill as localhost, and fill your port number (select option Use the Standar port number of 1521) or if use other port, fill the port number Then click next.
  • select Yes perform test, if necessary, change user logon then click next
  • if no configure another net service name, select No and then click next
  • you should download, extract and install the ODTwithODAC183.zip and BuildTools_Full.exe if you want use to connect on .net framework from MS Visual Studio

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question . Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers .