我们使用JDBC连接oracle数据库的连接字符串主要有如下写法:
1、通过SID连接
jdbc:oracle:thin:@<host>:<port>:<SID>
示例:jdbc:oracle:thin:@127.0.0.7:1521:orcl
2、通过ServiceName连接
jdbc:oracle:thin:@//<host>:<port>/<service_name>
示例: jdbc:oracle:thin:@//127.0.0.1:1521/orcl
3、使用TNS Name
扫描二维码关注公众号,回复:
1294920 查看本文章
jdbc:oracle:thin:@<TNSName>
Example: jdbc:oracle:thin:@TNSName
如果还是不行,那就把tnsName换成TNSName的定义