C # Oracle. DataAccess connection to Oracle

Source: Internet
Author: User
Tags oracle database

One is the 32-bit and 64-bit versions. If the application we developed is 32-bit, we must use a 32-bit client, if it is a 64-bit application, it certainly corresponds to a 64-bit client. Note: in a 64-bit environment, use the vsdevelopment Web program. The webservice running webdev.webserver.exe is 32-bit. Therefore, to debug a 64-bit oracle Connection program, you 'd better deploy it in iis and use iis to connect to the oracle database.

Another version issue is oracle. dataaccess version. My local machine is 32-bit xp. After the oracle11gr2 client is installed, the odp under the installation directory is displayed. you can find oracle in the netbin2.x directory. dataaccess. dll file. The version number is 2.112.1.2. So the program I developed references the library of this version.

However, the 64-bit oracle. dataaccess. dll is different. The installed version is 2.112.1.0, as shown in the figure below: oracle. dataaccess. dll on windows2008x64.

Now release and deploy the program in the development environment on the server, and an exception will be thrown.

Failed to load file or assembly "oracle. dataaccess, version = 2.112.1.2, culture = neutral, publickeytoken = 89b483f429c47342" or one of its dependencies.

Or

Cocould not load file or assembly 'Oracle. dataaccess, version = 2.112.1.2, culture = neutral, publickeytoken = 89b483f429c47342 'or one of its dependencies. an attempt was made to load a program with an incorrect format.

In short, the corresponding assembly cannot be found. Apparently, the system is looking for oracle 2.112.1.2. dataaccess, and only version 2.112.1.0 on the server, so the error is reported. The solution is in the web. after the configsections node ends, add the following content:

<Runtime>
<Assemblybinding xmlns = "urn: schemas-microsoft-com: asm. v1">
<Dependentassembly>
<Assemblyidentity name = "oracle. dataaccess"
Publickeytoken = "89b483f429c47342"
Culture = "neutral"/>
<Bindingredirect
Oldversion = "2.112.1.2"
Newversion = "2.112.1.0"/>
</Dependentassembly>
</Assemblybinding>
</Runtime>

In this way, iis can call oracle. dataaccess of 2.112.1.0. After this configuration is added, it can run normally.

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.