1

I'm deploying an application that uses an oracle provider with Oracle.DataAccess.dll in a machine that already has a specific version of ODAC 64-bit ODAC 11.2.

But the application I want to deploy uses a more recent version of ODAC 64-bit ODAC 12.2c. And in the root of that project I have the provider dll and its dependencies :

  • Oracle.DataAccess.dll
  • OraOps12.dll
  • oci.dll
  • ociw32.dll
  • Oracle.DataAccess.dll
  • orannzsbb12.dll
  • oraocci12.dll
  • oraociei12.dll

Once I deploy and run the application, I have the following error :

Unable to load DLL 'OraOps12.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I dont want to update the existing ODAC because it might be used by other applications.

I've checked different links as the following one: Oracle.DataAccess.Client Dependencies or this one : Oracle.Dataaccess is in the GAC. Can I control the version I use? but it didn't work for me.

Also i though about using Managed drivers, but based on this link, it doesn't support bulkcopy.

Is there a solution for this issue ? Or is there something I'm doing wrong ?

EDIT

My App.config file looks like this :

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.data>
        <DbProviderFactories>
            <remove invariant="Oracle.DataAccess.Client"></remove>
            <add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"></add>
        </DbProviderFactories>  
    </system.data>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-6.122.1.0" newVersion="4.122.1.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>
7
  • Do you need to use the Managed client? I generally use the Unmanaged client for this reason - other people can install or update/modify the oracle installations which could cause yours to stop working in the future. The only time I have found a reason to use the Managed driver is for Oracle Advanced Queue support. Commented Aug 3, 2018 at 12:30
  • Did you remove the policy DLLs from the GAC? Commented Aug 3, 2018 at 12:34
  • @DominicCotton the managed client can fix it indeed, but it does not support some operations we want to execute, bulkcopy for exemple. Commented Aug 6, 2018 at 17:57
  • @ChristianShay i tried that by adding <publisherPolicy apply="no" /> but it doesn't work Commented Aug 6, 2018 at 17:59
  • @DominicCotton Have you gotten your statements reversed? The managed driver is the one that has no external dependencies: it's entirely written in managed .NET code. Commented Aug 6, 2018 at 19:08

1 Answer 1

1

In general it is possible to install more than one version of ODP.NET (Oracle.DataAccess) provider. However, due to unmanaged dependencies you would have to verify/modify the %PATH% environment variable each time before you launch an application which uses an Oracle driver. I don't think this would be a suitable solution.

I would see three possible solutions.

Solution 1

Remove the version attribute from reference. Then the application will load whatever ODP.NET version is installed on the machine.

In your *.csproj, resp. *.vbproj edit your reference to ODP.NET from

<Reference Include="Oracle.DataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86">

to this

<Reference Include="Oracle.DataAccess">
  <SpecificVersion>False</SpecificVersion>
  <Private>False</Private>
</Reference>

I never developed a web-sevice, but I assume in web.config file it would be this:

<configuration>
    <system.data>
        <DbProviderFactories>
            <remove invariant="Oracle.DataAccess.Client"></remove>
            <add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" 
                 description="Oracle Data Provider for .NET" 
                 type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess"></add>
        </DbProviderFactories>  
    </system.data>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Oracle.DataAccess" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

Solution 2

Install Oracle ODP.NET version 12.2 at target machine. Usually this is no problem unless other applications force a specific version (see How to load specific version of assembly from GAC). Other applications which are using Oracle.DataAccess will be redirected automatically to version 12.2 - provided it is installed properly. When I did the last installation of Oracle 12.2 the ODP.NET was not installed in GAC, however you can configure it manually:

For 64-bit Version:

set Oracle_x64=c:\oracle\product\12.2\Client_x64\odp.net
set OraProvCfg_x64=%Oracle_x64%\bin\4\OraProvCfg.exe

"%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\bin\2.x\Oracle.DataAccess.dll
"%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\2.x\Policy.2.102.Oracle.DataAccess.dll
"%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\2.x\Policy.2.111.Oracle.DataAccess.dll
"%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\2.x\Policy.2.112.Oracle.DataAccess.dll
"%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\2.x\Policy.2.121.Oracle.DataAccess.dll
"%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\2.x\Policy.2.122.Oracle.DataAccess.dll
"%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\bin\4\Oracle.DataAccess.dll
"%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\4\Policy.4.112.Oracle.DataAccess.dll
"%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\4\Policy.4.121.Oracle.DataAccess.dll
"%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\PublisherPolicy\4\Policy.4.122.Oracle.DataAccess.dll

For 32-bit Version:

set Oracle_x86=c:\oracle\product\12.2\Client_x86\odp.net
set OraProvCfg_x86=%Oracle_x86%\bin\4\OraProvCfg.exe

"%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\bin\2.x\Oracle.DataAccess.dll
"%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\2.x\Policy.2.102.Oracle.DataAccess.dll
"%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\2.x\Policy.2.111.Oracle.DataAccess.dll
"%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\2.x\Policy.2.112.Oracle.DataAccess.dll
"%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\2.x\Policy.2.121.Oracle.DataAccess.dll
"%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\2.x\Policy.2.122.Oracle.DataAccess.dll
"%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\bin\4\Oracle.DataAccess.dll
"%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\4\Policy.4.112.Oracle.DataAccess.dll
"%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\4\Policy.4.121.Oracle.DataAccess.dll
"%OraProvCfg_x86%" /action:gac /providerpath:%Oracle_x86%\PublisherPolicy\4\Policy.4.122.Oracle.DataAccess.dll

For ODP.NET Manged Driver (just for information):

set Oracle_x64=c:\oracle\product\12.2\Client_x64\odp.net
set OraProvCfg_x64=%Oracle_x64%\managed\x64\OraProvCfg.exe

"%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\managed\common\Oracle.ManagedDataAccess.dll
"%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\managed\PublisherPolicy\4\Policy.4.121.Oracle.ManagedDataAccess.dll
"%OraProvCfg_x64%" /action:gac /providerpath:%Oracle_x64%\managed\PublisherPolicy\4\Policy.4.122.Oracle.ManagedDataAccess.dll

Solution 3

Go to target machine and grab the Oracle.DataAccess.dll file (just the single DLL) and copy it to your development machine. Make a reference to this DLL. When you run/deploy your application then you will be automatically redirected to version 12.2, provided it is installed properly, see above.

Sign up to request clarification or add additional context in comments.

5 Comments

The problem with this, it's that some applications need to target a specific version. If the server has an old Dlls installed, it will not work and the newly installed application requires more recent dlls to be work.
As @billybob says we want to target a specific version.
Why do you want to load a specific version?
@WernfriedDomscheit the first solution didn't work for me, and in the solution 2, you suggested to have the latest version and all the application will use that one ! I don't want to be forced to do that every time i installed the application in a new machine. and the solution 3 suggested to use Managed dlls, but unfortunately we cannot do bulkcopy with that
@cheikhndiaye, sorry did a typo at solution 3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.