C#不安装Oracle客户端连接Oracle数据库,使用微软自带System.Data.OracleClient访问Oracle

来源:互联网 发布:北京邮电网络教育平台 编辑:程序博客网 时间:2024/06/05 15:27
1、把instantclient-basic-win32-10.2.0.4.zip中的文件解压到指定位置,以下步骤都假设解压目录为:C:\\Oracle\\instantclient

注:下载地址:http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html;

需注册用户,我下载的是:instantclient-basic-win32-10.2.0.4.zip) 

2、添加注册表内容(将以下内容保存到x.reg文件中,直接运行):(其内容如下,涉及到的文件位置的根据自己需要改) 

Windows Registry Editor Version 5.00 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment] 

"LD_LIBRARY_PATH"="C:\\Oracle\\instantclient"  

"TNS_ADMIN"="C:\\Oracle\\instantclient"

"NLS_LANG"="AMERICAN_AMERICA.ZHS16GBK" 

3、添加环境变量(此步很重要,否则报System.Data.OracleClient requiresOracle client software version 8.1.7 or greater

右键单击“我的电脑”-->“属性”-->“高级”-->“环境变量”-->“系统变量”-->选中“Path”-->“编辑”-->在“变量值”原来的数据后添加";C:\\Oracle\\instantclient"

4、如果要在数据库连接串中添加oracle的数据库连接方式,则不用此步。否则

添加tnsnames.ora文件(添加到C:\\Oracle\\instantclient文件中):



0 1
原创粉丝点击