How to fix “The provider is not compatible with the version of Oracle client”?

两盒软妹~` 提交于 2019-12-04 07:16:21

you can install Oracle.ManagedDataAccess using Package Manager Console nuget

Pm> Install-Package Oracle.ManagedDataAccess

ODP.NET, Managed Driver is a 100% native .NET code driver. No additional Oracle Client software is required to be installed to connect to Oracle Database.

Update Code

using Oracle.ManagedDataAccess.Client;
private static void CheckConnectionUsingOracleClient(string connection)
        {
            var logger = DiContainer.Resolve<ILogger>();

            try
            {
                logger.LogInfo("Trying to connect to " + connection);
                // check whether you can connect to the shop using Oracle.DataAccess
                using (var cnn = new OracleConnection(connection))
                {
                    cnn.Open();
                    cnn.Close();
                }

                logger.LogInfo("Succeeded to connect to " + connection);
            }
            catch (System.Exception ex)
            {
                logger.LogError("Failed to connect to " + connection, ex);
            }
        }

Oracle.DataProvider version 2.102.2.20 decripted

2: .Net version (can be 1 for .Net 1 - 1.1, 2 for 2 - 3.5 and 4 for 4 - 4.5)

102: Oracle version: Oracle 10.2

2.20: Oracle Data access version

You should check

  1. .Net version (should not be higher than your .Net compiler)

  2. Oracle client version (should not exceed Oracle Client version)

  3. Both Oracle client and Oracle.DataProvider are 64-bit or Oracle.DataProvider is 32 bit and Oracle client is either 32 bit or supports legacy 32 bit mode

After installation make sure:

  • PATH is updated with Oracle dlls location: \product\12.1.0\client_1\bin and \product\12.1.0\client_1
  • Restart the server.
  • Enable 32bit for the App Pool in IIS.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!