不安装Oracle10g客户端连接Oracle10g数据库【转】

方法如下:(环境:Vs2008+Oracle10g)

1、把instantclient-basic-win32-10.2.0.4.zip中的文件解压到指定位置(我本机是解压到D:\fox,并命名为:instantclient)
其内面应该包括:BASIC_README、oci.dll、ocijdbc10.dll、ociw32.dll、orannzsbb10.dll、oraocci10.dll、oraociei10.dll、classes12.jar、ojdbc14.jar九个文件.
(注:下载地址:http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html;需注册用户,我下载的是:instantclient-basic-win32-10.2.0.4.zip)

2、添加tnsnames.ora文件(添加到D:\fox\instantclient文件中):
    文件tnsnames.ora其内容:
# tnsnames.ora Network Configuration File: D:\fox\instantclient\tnsnames.ora /*这是此文件地址*/
# Generated by Oracle configuration tools.

ORCL1 =/*这是本机联系Oracle服务器的服务名称,代码中用到*/
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 服务器地址IP 或服务器名称)(PORT = 服务器端口号,默认为“1521“))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = 服务器数据库服务的名字,默认为:”orcl“)
    )
  )

 

3、添加注册表内容:(其内容如下,涉及到的文件位置的根据自己需要改)

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
"LD_LIBRARY_PATH"="D:\\fox\\instantclient"
"TNS_ADMIN"="D:\\fox\\instantclient"
"NLS_LANG"="AMERICAN_AMERICA.ZHS16GBK"


4、添加环境变量

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

 

5、重启计算机。


本文来自CSDN博客,转载自:http://blog.csdn.net/lhg0302/archive/2009/04/11/4062569.aspx

posted @ 2009-08-17 15:09  *王员外*  阅读(688)  评论(4编辑  收藏  举报