Gen 8.6 .NET Failed to load DbProviderFactory for "Oracle.ManagedDataAccess.Client"
search cancel

Gen 8.6 .NET Failed to load DbProviderFactory for "Oracle.ManagedDataAccess.Client"

book

Article ID: 440328

calendar_today

Updated On:

Products

Gen Gen - Run Time Distributed

Issue/Introduction

Testing Gen 8.6 sample model cooperative application for .NET/C# under Windows Server 2022 VM.
Generated Server Manager P900 for CLR/Oracle/C#.
Assembled and under DataSources "Server Connection Strings", disabled the Encrypt option and set:
Name = GENDB
Data Provider = Oracle.ManagedDataAccess.Client
Data Connection String =  Data Source=orcl;User ID=genuser;Password=genuser

After installing the application sample.msi file when the server is called using .NET remoting from a C client see this error:

05/13/26-04:19:17:733350[1]: DataSource::Connect(): Attempting to open a DbConnection for (Name=GENDB, ProviderName=Oracle.ManagedDataAccess.Client)
05/13/26-04:19:17:889596[1]: DataSource::Connect(): Failed to load DbProviderFactory for "Oracle.ManagedDataAccess.Client", caught: Unable to find the requested .Net Framework Data Provider.  It may not be installed.

Environment

Gen 8.6 .NET CLR/C#/Oracle

Cause

The Oracle Data Provider for .NET ODAC option has been installed via Oracle 32-bit client install (install type "Administrator").
The file Oracle.ManagedDataAccess.dll is visible in directory "C:\app\oracle\product\19.0.0\client_1\odp.net\managed\common".
Per Oracle doc page Oracle® Data Provider for .NET > Developer's Guide> 19c > Installing and Configuring Oracle Data Provider for .NET > Installing Oracle Data Provider for .NET, Managed Driver a configure.bat can be run but that only seems to add registry entries.

To resolve the problem the Oracle.ManagedDataAccess.dll needs to be:

  1. Added to the .NET Framework GAC_MISL (architecture-independent assemblies compiled with "Any CPU")

  2. Added to the .NET Framework main file "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config".

Resolution

The Oracle utility OraProvCfg.exe can be used to do this.
There is a version to update both x86 .NET Framework machine.config ("C:\app\oracle\product\19.0.0\client_1\odp.net\managed\x86\OraProvCfg.exe") and x64 .NET Framework machine.config ("C:\app\oracle\product\19.0.0\client_1\odp.net\managed\x64\OraProvCfg.exe").
Only the latter was needed in step 2 to resolve this problem - See Additional Information.

  1. Add Oracle.ManagedDataAccess to GAC_MISL:
    C:\>"C:\app\oracle\product\19.0.0\client_1\odp.net\managed\x64\OraProvCfg.exe" /action:gac /providerpath:"C:\app\oracle\product\19.0.0\client_1\odp.net\managed\common\Oracle.ManagedDataAccess.dll"
    INFO: c:\app\oracle\product\19.0.0\client_1\odp.net\managed\common\oracle.manageddataaccess.dll is registered successfully in GAC.

    Verify with gacutil.exe:
    C:\>"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\gacutil.exe" /l Oracle.ManagedDataAccess
    Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.0
    Copyright (c) Microsoft Corporation.  All rights reserved.
    The Global Assembly Cache contains the following assemblies:
      Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL
    Number of items = 1


  2. Add Oracle.ManagedDataAccess to machine.config file:
    C:\Users\Administrator>"C:\app\oracle\product\19.0.0\client_1\odp.net\managed\x64\OraProvCfg.exe" /action:config /product:odpm /frameworkversion:v4.0.30319 /providerpath:"C:\app\oracle\product\19.0.0\client_1\odp.net\managed\common\Oracle.ManagedDataAccess.dll"

    INFO: The following section has been added.
    <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />

    INFO: The following element added under DbProviderFactories.
    <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />


  3. Go to "Control Panel > Administrative Tools> Component Services > Computers > My Computer > COM+ Applications".
    To force a re-read of the machine.config file use right mouse button the "sample" application and select "Shut down" and then "Start".
    When the server is called again the "Oracle.ManagedDataAccess.Client" is found and the problem is resolved.


Example final "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config" also attached.

Additional Information

The built Gen sample model sample.msi file installed to directory "C:\Program Files (x86)\Broadcom\sample" because Build Tool OPTIONS token OPT.BITS was set to default value 32.
However Gen .NET applications are compiled with the 'Platform=AnyCPU' option and can be run as x86 or x64 per Is 64-bit supported for Gen 8.6 .NET proxies, clients or servers.
During this research it was found that the application was being run under x64 .NET Framework which is why this file was changed: "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config".
Similar changes were first tried in the x86 file "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config" using "C:\app\oracle\product\19.0.0\client_1\odp.net\managed\x86\OraProvCfg.exe" in step 2 of the Resolution but they had no effect on the problem.

Attachments

machine.config get_app