1.配置Oracle Instant Client环境
到Oracle官网下载Oracle Instant Client,注意选择x86平台,Toad只认32位的Oracle Instant Client。至于版本号,没有特别要求,版本向下兼容。
桌面上,右键点“我的电脑”,选择“属性”,选择“高级”页中的“环境变量”,在系统变量中,修改如下
变量名:ORACLE_HOME
变量值:D:\Program Files\instantclient_11_2
变量名:TNS_ADMIN
变量值:D:\Program Files\instantclient_11_2
变量名:NLS_LANG
变量值:SIMPLIFIED CHINESE_CHINA.ZHS16GBK
修改Path变量,在后面添加 D:\Program Files\instantclient_11_2
在D:\Program Files\instantclient_11_2新建一个文本文件,文件名为tnsnames.ora
#orcl可以自定义替换
#HOST修改为Oracle Server地址
#SERVICE_NAME修改为Oracle实例名
orcl =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.30.85)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
转自:http://blog.csdn.net/shenhonglei1234/article/details/7257741
注意:OFFICE_ORCL =
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.30.85)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) ) 配置文件代码中: driverClassName=oracle.jdbc.driver.OracleDriver validationQuery=SELECT 1 FROM DUAL #以下是两种数据库连接方式,thin和oci #jdbc_url=jdbc:oracle:thin:@192.168.2.203:1521:orcl jdbc_url=jdbc:oracle:oci:@OFFICE_ORCL jdbc_username=TEST1 jdbc_password=TEST1 “OFFICE_ORCL”即为:“jdbc_url=jdbc:oracle:oci:@OFFICE_ORCL”中最后那个数据库名