我能够成功连接到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
凭据与在服务器资源管理器中输入的凭据相同
我该如何解决这个问题?
1条答案
按热度按时间xvw2m8pv1#
可能有几个原因。最常见的是:
Oracle.DataAccess
和Oracle客户端之间的版本不匹配,或者未安装Oracle客户端有关详细信息,请参阅提供程序与Oracle客户端版本不兼容