简体   繁体   中英

ODP.NET for both 32bit and 64bit

I am developing application which uses ODP.NET to connect to Oracle DB. I would like to have one version for both 32bit and 64bit machines. The problem is that I couldn't figure out how to build projetc with anycpu target, seems it requires the target to be the same as ODP driver version. So it means that I need to have to versions of the same application one for 32bit and other for 64bit. But the same was not problem while using MS .NET Oracle client (System.Data.OracleClient). Is there a way to have the same behavior using ODP.NET as on MS .NET client?

Just update few years later: Oracle released managed ODP.NET client, so there's no need to bother with x64/x86 in .NET applications any more. You can find more information on Oracle website: http://www.oracle.com/technetwork/topics/dotnet/index-085163.html

The root cause is the ODP.NET's reliance on native OCI DLLs , which of course cannot be "Any CPU".

Theoretically, ODP.NET could detect the "bit-ness" of the current execution in the .NET code and then dynamically load either 32-bit or 64-bit native DLLs accordingly, but that's not how it is currently implemented.

Oracle corporation is currently in the process of implementing a fully managed provider . But until then , we are stuck with having to do separate builds for each "bit-ness".

The default option for any C# project is it will work on both x64 and x86 operating systems.

So it means that I need to have to versions of the same application one for 32bit and other for 64bit. But the same was not problem while using MS .NET Oracle client (System.Data.OracleClient).

This is expected....You need to release a x86 version and a x64 version, please take note, x86 application cannot reference a x64 assembly and vice-versa.

The reason the Microsoft reference was different was because its part of the .NET Framework by default.

I cannot download the file where I am at, I do believe that, ODP.NET has a x86 assembly and a x64 assembly.

The correct way is to release a x86 version and a x64 version of your program.

ODP.NET is specifically built for either 32-bit or 64-bit platform. They could have built a single library for AnyCPU which would allow it to be used in a 32-bit or 64-bit process. However, as Branko Dimitrijevic alluded to, the ODP.NET managed dll uses native libraries behind the scenes. Native libraries are platform-specific; thus requiring Oracle to build separate ODP.NET library for each platform. There is no alternative.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM