ODP.NET for both 32bit and 64bit

16,268

Solution 1

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

Solution 2

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".

Solution 3

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.

Share:
16,268
NDeveloper
Author by

NDeveloper

Updated on June 30, 2022

Comments

  • NDeveloper
    NDeveloper almost 2 years

    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?

  • one.beat.consumer
    one.beat.consumer over 11 years
    You don't need separate builds. Any CPU is fine, so long as the deploy target only has one oracle client and you are referencing the DLL in the GAC. For instance, I build web apps for a 64-bit server. My project references the 32-bit data access library from GAC, but when I deploy, it looks for the same library in GAC and finds the 64-bit copy... and it runs perfect.
  • surfen
    surfen over 10 years
    Caution: ODP.NET 12.* does not support Oracle 9 databases (only 10.2 or newer are supported)
  • BradleyDotNET
    BradleyDotNET over 9 years
    What does this add to the existing answers?
  • StingyJack
    StingyJack over 6 years
    Unfortunately, they still compile the managed assemblies as explicit x86 or x64. so we can expect more of the same Processor Architecture warnings/errors when using AnyCPU
  • StingyJack
    StingyJack over 6 years
    "Correct way" != "the way that oracle forces you to make it work". Twice the release footprint may be manageable when you charge the license fees they do for the db, but most of us dont have that kind of capital.