The provider is not compatible with the version of Oracle client sometimes (提供程序与此版本的 Oracle 客户机不兼容)
2016-11-10 16:37
736 查看
其实这个问题很直观,就是你在C#项目中使用的Oracal.DataAcess.dll文件的版本与你电脑上安装的ODAC.EXE(ODP.NET)版本不一致,不论是32位或者是64位平台不一致,还是版本的高低不一致,反正就是不匹配造成了问题。具体的解决办法网上有很多,这里就不再细讲。
但是这次我遇到的问题很奇怪。我的机器上都装了多个ODAC.EXE的版本,包括两个64位的,一个32位的,而且明明我在C#中使用的Oracle.DataAccess.dll的版本跟某个ODAC是完全一致的,但是还是抛出了The
provider is not compatible with theversion of Oracle client sometimes这个异常,这让我很费解。而且更奇怪的是,这个异常并不是每次都抛出来,时而有时而没有,也就是说,我的代码与数据库的连接,一会能连上一会不能连上,全部靠运气。
找了很久,终于找到了问题的根源。因为这是一个遗留的项目,我下载到了本地,看到了这个项目中有圈起来的那几个文件,虽然觉得奇怪,我也没有在意太多。但是正是这几个文件,才造成了上述的问题。当我把这几个文件移除之后重新编译了一下,就一切正常了,能正常连接到数据库。所以,这次总结的道理就是,在有关Oracle的C#项目中,不要随便引入oci这些文件。(知道此刻我都不知道为什么前人做这个项目的时候会引入这几个文件。)
但是这次我遇到的问题很奇怪。我的机器上都装了多个ODAC.EXE的版本,包括两个64位的,一个32位的,而且明明我在C#中使用的Oracle.DataAccess.dll的版本跟某个ODAC是完全一致的,但是还是抛出了The
provider is not compatible with theversion of Oracle client sometimes这个异常,这让我很费解。而且更奇怪的是,这个异常并不是每次都抛出来,时而有时而没有,也就是说,我的代码与数据库的连接,一会能连上一会不能连上,全部靠运气。
找了很久,终于找到了问题的根源。因为这是一个遗留的项目,我下载到了本地,看到了这个项目中有圈起来的那几个文件,虽然觉得奇怪,我也没有在意太多。但是正是这几个文件,才造成了上述的问题。当我把这几个文件移除之后重新编译了一下,就一切正常了,能正常连接到数据库。所以,这次总结的道理就是,在有关Oracle的C#项目中,不要随便引入oci这些文件。(知道此刻我都不知道为什么前人做这个项目的时候会引入这几个文件。)
相关文章推荐
- The provider is not compatible with the version of Oracle client
- The provider is not compatible with the version of Oracle client
- The provider is not compatible with the version of Oracle client
- The provider is not compatible with the version of Oracle client
- Ubuntu 16.04使用NASM编译时用ld链接程序出现:i386 架构于输入文件 sandbox.o 与 i386:x86-64 输出不兼容(I386 architecture in the input file sandbox.o is not compatible with i386: x86-64 output)
- Oracle FAQ: 未在本地计算机上注册"OraOLEDB.Oracle"提供程序 (The 'OraOLEDB.Oracle' provider is not registered on the local machine) solution
- Oracle.DataAccess.Client.OracleException: 提供程序与此版本的 Oracle 客户机不兼容
- “Oracle.DataAccess.Client.OracleException: 提供程序与此版本的 Oracle 客户机不兼容”问题的解决方案
- mvn install Geoserver under ubuntu10.04 时遇到的错误:the API of the mojo scanner is not compatible with this plugin version. 的解决方法
- Ubuntu Error: the system network service is not compatible with this version
- Cannot connect to WMI provider.You do not have permission or the server is unreachable.Note that you can only manager SQL Server 2005 and later version with SQL Server Configuration Manager.Invalid namespace [0x8004100e]
- 提供程序与此版本的 Oracle 客户机不兼容
- The base class includes the field '...', but its type (...) is not compatible with the type of control (...)
- (System.Web.UI.HtmlControls.HtmlIframe) is not compatible with the type of control (System.Web.UI.Ht
- SLF4J: The requested version 1.5.8 by your slf4j binding is not compatible with [1.6] SLF4J: See htt
- The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid
- .Net Core 控制台程序错误:Can not find runtime target for framework '.NETCoreApp,Version=v1.0' compatible with one of the target runtimes: 'win10-x64, win81-x64, win8-x64, win7-x64'.
- (Microsoft.Reporting.WebForms.ReportViewer) is not compatible with the type of control (Microsoft.Reporting.WebForms.ReportViewer)
- Apple is not currently accepting applications built with this version of the SDK Xcode 1091
- The Excel Connection Manager is not supported in the 64-bit version of SSIS, as no OLE DB provider i 推荐