VS2010 connecting 64-bit Oracle in a 64-bit system problems and workarounds

Source: Internet
Author: User

C # uses System.Data.OracleClient to connect to an Oracle database. My is WINDOW7/64 bit system, installed a 64-bit ORALCE 11G R2 client is 64-bit with VS10 debug error message as follows:

Badimagefomatexception is raised when attempting to load the Oracle client library. This problem occurs if you are running in 32-bit mode with the 64-bit Oracle client component installed.

The cause of the error is that the VS debugging tool is 32 bits, and the OracleClient used by the connected program is also 64 bits, causing compatibility problems. Of course, if you press 64-bit to recompile a 64-bit Oracle client on a 64-bit operating system, then recompiling the program will also solve the problem. Here we introduce an easy way to connect a program if you install the Oracle database locally without having to install the client at all.

In fact, System.Data.OracleClient points to the Oci.dll under the PATH environment variable. So we just have to let the program find 64-bit or 32-bit oci.dll. Here's how:

    1. Download, and unzip, such as C:\instantclient-basic-win-x86-64-11.1 this is a 32-bit client C:\instantclient-basic-nt-11.2.0.3.0 If you use vs best Choose 32 bit of 64 bit I tried it as if debugging or error. Of course you are deployed to IIS to be sure that all two are available.

2. Add the above path to the system's environment variable path.

Then run the program, the program will follow the path path to find Oci.dll, the program will automatically find 32-bit or 64-bit oci.dll can connect to the database.

Oracle database Download Link:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

If not, download the latest Oracle client:http://www.oracle.com/technetwork/topics/winsoft-085727.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.