使用Oracle.DataClient时provider与Oracle客户端版本不兼容报错 [英] The provider is not compatible with the version of Oracle client error when using Oracle.DataClient

查看:112
本文介绍了使用Oracle.DataClient时provider与Oracle客户端版本不兼容报错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Visual Studio 2008 Express Edition,并且正在尝试使用 Oracle.DataClient 开发一个小型应用程序.尝试连接到目标系统中的数据库时,出现上述错误.

I'm using Visual Studio 2008 Express Edition, and I'm trying my hand in developing a small application using Oracle.DataClient. I'm getting the above mentioned error, when trying to connect to the database in the target system.

我为 Oracle 10gR2 添加了对 Oracle ODP.net 提供程序的引用,并且在目标机器中我安装了 Oracle 10gR2 数据库的副本.尽管如此,我还是收到了错误消息.在发布之前,我阅读了这篇文章 在 SO,并且我已经安装了即时客户端,错误仍然存​​在.以下是完整的错误堆栈.

I've added a reference to Oracle ODP.net provider for Oracle 10gR2, and in the target machine I have a copy of Oracle 10gR2 database installed. Despite this, I'm getting the error. Before posting this, I read this post at SO, and I have installed the instant client, the error persists. Below is the full error stack.

************** Exception Text **************
System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. ---> Oracle.DataAccess.Client.OracleException The provider is not compatible with the version of Oracle client    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)
   at Employees1.frmLogin.oralogin()
   at Employees1.frmLogin.btnTest_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
API Data Conversion Assistant
    Assembly Version: 0.0.0.1
    Win32 Version: 0.0.0.1
    CodeBase: file:///C:/Documents%20and%20Settings/3i/My%20Documents/My%20Dropbox/Sathya's%20dropbox/VisualStudio%20Releases/APIDataconversion/Application%20Files/API%20Data%20Conversion%20Assistant_0_0_0_3/API%20Data%20Conversion%20Assistant.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Oracle.DataAccess
    Assembly Version: 2.102.2.20
    Win32 Version: 2.102.2.20

我在开发应用程序的机器上安装了 Oracle 11g,在那里运行良好,但在目标机器上,我收到此错误.任何输入将不胜感激.

I have Oracle 11g installed on the machine on which I developed the application, and it works fine there, but on the target machine, I'm getting this error. Any inputs will be appreciated.

PS:如上所述,引用的 Oracle.DataClient.dll 文件版本对应的是 10gR2,而不是 11g.

PS: As mentioned above, the referenced Oracle.DataClient.dll file version corresponds to 10gR2, not 11g.

推荐答案

我一直在进一步研究这个问题,你只需要从同一个下载的 ODP.Net 版本中获取所有适当的 DLL 并将它们放入与您的 Exe 文件相同的文件夹,因为 ODP.Net 对不混合版本号很挑剔,这就是您看到的问题(要么完全丢失,要么完全丢失 oci.dll,在这种情况下,它会令人讨厌地给出相同的错误).

I've been looking into this problem further, and you simply need to grab all the appropriate DLL's from the same downloaded version of ODP.Net and put them in the same folder as your Exe file, because ODP.Net is fussy about not mixing version numbers, which is the problem you're seeing (either that or the oci.dll is totally missing, in which case it annoyingly gives the same error).

我在这里解释了如何做到这一点:http://splinter.com.au/using-the-new-odpnet-to-access-oracle-from-c不过,这是它的要点:

I've explained how to do this here: http://splinter.com.au/using-the-new-odpnet-to-access-oracle-from-c Here's the gist of it though:

这篇关于使用Oracle.DataClient时provider与Oracle客户端版本不兼容报错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆