尝试连接到Oracle数据库时出错

0vvn1miw  于 2022-11-28  发布在  Oracle
关注(0)|答案(1)|浏览(310)

我能够成功连接到Oracle数据库,如下图所示:

但是,当我尝试连接并通过代码进行查询时,我收到错误:

ERROR:  Message:System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'OraOps12.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at Oracle.DataAccess.Client.OpsInit.CheckVersionCompatibility(String version)
   at Oracle.DataAccess.Client.OracleInit.Initialize()
   at Oracle.DataAccess.Client.OracleConnection..cctor()
   --- End of inner exception stack trace ---
   at Oracle.DataAccess.Client.OracleConnection..ctor(String connectionString)


在Oracle连接行上:

string oradb = "Data Source=" + oracleDataSource + ";User Id=" + oracleUserID + ";Password=" + oraclePassword + ";";

OracleConnection conn = new OracleConnection(oradb); <----error thrown here

凭据与在服务器资源管理器中输入的凭据相同
我该如何解决这个问题?

xvw2m8pv

xvw2m8pv1#

可能有几个原因。最常见的是:

  • 32位与64位不匹配
  • Oracle.DataAccess和Oracle客户端之间的版本不匹配,或者未安装Oracle客户端

有关详细信息,请参阅提供程序与Oracle客户端版本不兼容

相关问题