java远程调用oracle注意事项

 

// DBUtil部分


public final static String URL="jdbc:oracle:thin:@192.168.X.XX:1521:sid_name";  // URL
public final static String USERNAME="XXXXX";//用户名
public final static String PWD="XXXXX";//密码
public final static String DRIVER="oracle.jdbc.driver.OracleDriver";

 

//文件设置 listenner.ora

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\......)  //oracle本地安装地址
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\......\oraclr12.dll")
)
(SID_DESC =
(SID_NAME =XXX)
(ORACLE_HOME =D:\app\......)   //oracle本地安装地址
(GLOBAL_DBNAME =XXX)  //与sid_name相同
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.X.XX)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

 

// 文件设置 tnsnames.ora

XXX(数据库名)=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.X.XX)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = xxxxx)   //与sid_name 无关
)
)

 

附上ORACLE中极易混淆的几个NAME的分析和总结:

https://www.2cto.com/database/201407/321564.html

 

posted @ 2019-05-27 12:00  Cate_Hunter  阅读(261)  评论(0编辑  收藏  举报