简体   繁体   English

无法使用c#连接到Oracle

[英]Trouble connecting to Oracle with c#

I have trouble connecting to an Oracle 11g XE instance that is running on a VM (on my local machine). 我无法连接到在VM(在我的本地计算机上)上运行的Oracle 11g XE实例。 I'm trying to connect to it with c# using: 我正在尝试使用c#连接到它:

using System.Data.OracleClient;
OracleConnection conn = new OracleConnection("User Id=system;Password=mypassword;Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.102)(PORT=1521))(CONNECT_DATA=(SID=UDW))););
    oc.Open();

Error I'm getting is: 我得到的错误是:

System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.

Does this point to Oracle, or the version of the DLL? 这是指向Oracle,还是DLL的版本? Oracle is higher than 8. Oracle高于8。

To do it right, you need to install Oracle client and use Oracle.DataAccess.Dll that will be installed in that client directory under ODP.net directory. 要做到这一点,您需要安装Oracle客户端并使用将安装在ODP.net目录下的该客户端目录中的Oracle.DataAccess.Dll。 This is recommended way to connect to Oracle even though, Microsoft provides OleDb (not recommended to use) and System.Data.OracleClient . 这是连接到Oracle的推荐方法,即使Microsoft提供OleDb(不建议使用)和System.Data.OracleClient Microsoft recommendation is to use provider-native data connectivity. Microsoft建议使用提供程序本机数据连接。 Oracle provides both clients, for x86 and x64. Oracle为x86和x64提供了两个客户端。 Using ODP.net allows for Oracle optimizations. 使用ODP.net可以进行Oracle优化。

it seems you need to update the oracle client library on your client machine. 您似乎需要更新客户端计算机上的oracle客户端库。 download it Oracle downloads 下载Oracle下载

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM