一.JDBC 鏈接Oracle 說明oracle
JDBC 的應用鏈接Oracle 遇到問題,錯誤以下:app
ORA-12505,TNS:listener does not currently know of SID given in connect descriptor TheConnection descriptor used by the client was。google
我在DB 層面配置了靜態註冊,而且GLOBAL_DBNAME和SID_NAME 不同,以往的配置都是同樣的,因此沒有發現這個問題。.net
(SID_DESC =orm
(GLOBAL_DBNAME = dave)blog
(ORACLE_HOME =D:\app\Administrator\product\11.2.0\dbhome_1)ip
(SID_NAME = NEWCCS)it
)io
Oracle Listener 動態註冊 與 靜態註冊form
http://blog.csdn.net/tianlesoftware/article/details/5543166
在網上google 了一下,發現JDBC Thin Driver 的formats 有三種格式:
格式一: Oracle JDBC Thin using a ServiceName:
jdbc:oracle:thin:@//<host>:<port>/<service_name>
Example: jdbc:oracle:thin:@//192.168.2.1:1521/XE
注意這裏的格式,@後面有//, 這是與使用SID的主要區別。
這種格式是Oracle 推薦的格式,由於對於集羣來講,每一個節點的SID 是不同的,可是SERVICE_NAME 確能夠包含全部節點。
格式二: Oracle JDBC Thin using an SID:
jdbc:oracle:thin:@<host>:<port>:<SID>
Example: jdbc:oracle:thin:192.168.2.1:1521:X01A
Note: Support for SID is being phased out. Oracle recommends that users switch over to usingservice names.
格式三:Oracle JDBC Thin using a TNSName:
jdbc:oracle:thin:@<TNSName>
Example: jdbc:oracle:thin:@GL
Note:
Support for TNSNames was added in the driver release 10.2.0.1