"Error: Unable to initialize for provider System.Data.OracleClient at WebReports.Api.Data.DbConnect.SetDbInfo(DbInfo dbInfo)" - Error message appears while Data Source connection testing fails in Ginesys Report menu.

SYMPTOMS


In Ginesys Report module , there is an option to test Ginesys Data Source connection from Server tab. Sometime users may face a problem while they are trying test Data Source of Ginesys . The below error message appeared on screen.

Connection failed for GINESYS:
Error: Unable to initialize for provider System.Data.OracleClient at WebReports.Api.Data.DbConnect.SetDbInfo(DbInfo dbInfo)
at WebReports.Api.Data.DbConnect..ctor(PageInfo pageInfo, DbInfo dbInfo, String connStr)
at WebReports.Api.Data.OracleDbConnect..ctor(PageInfo pageInfo, String connStr)
at WebReports.Api.Data.DbConnect.CreateObject(PageInfo pageInfo, String dbType, String dataConnStr, String odbcDelim)
at WebReports.Api.Data.SqlObject.CreateConnectionObject(String dbType, String dataConnStr)
at WebReports.Api.Data.DataObjectBase.GetDataObject(PageInfo pageInfo, String dbType, String dataConnStr)
at WebReports.UI.Controls.AdminDataSourceCtrl.TestConnection(String dbType, String connectStr)

Further Observation & Action taken :

  1. GINVIEW schema connection was successful while attempting using SQL plus.

  2. SYNC of Repository tab happened properly.

  3. IIS Reset performed but still Data Source test connection was not happening.

  4. No multiple Network adapter found in the system.

CAUSE


Duplicate entries exist for 'Oracle.DataAccess.Client' under DBProviderFactories section in .NET Framework 4 configuration (machine.config), entries having mention invariant="Oracle.DataAccess.Client. When the program tries to load the information of DB Providers which is mentioned in machine.config it detects the duplicate provider entries.

Path of Config file:

%SystemRoot%\Microsoft.NET\Framework64\v4.0.xxxx\CONFIG\

Config file:
machine.config

Sample file path:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config

Area to look into:
DbProviderFactories section.

RESOLUTION


Before modifying the machine.config file keep a backup of existing machine.config file.

  • Open the machine.config file from the path <System Drive>\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config.

  • Then find the <DbProviderFactories> section under <system.data> tag where we can see duplicate entries of “Oracle.DataAccess.Client“ with various version. Remove one entry which is older with respect to version ( 4.121.1.0 & 4.121.2.0) & keep the current version. Here we will remove the version 4.121.1.0 .

  • Then save the machine.config file & check the Data Source connection again.

As an example of duplicate entries shown below :

<system.data> <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.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/> <add name="ODP.NET, Unmanaged Driver" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET, Unmanaged Driver" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> <add name="ODP.NET, Unmanaged Driver" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET, Unmanaged Driver" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> </DbProviderFactories> </system.data>

Corrected entries of <DbProviderFactories> given below

<system.data> <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.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/> <add name="ODP.NET, Unmanaged Driver" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET, Unmanaged Driver" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> </DbProviderFactories> </system.data>

RELATED ARTICLE