一.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