jdbc oracle 连接串
jdbc.url配置为:
jdbc:oracle:thin:@xxx.xx.xx.xx:1521:orclpdb
报错:
java.sql.SQLException: Listenerrefused the connection with the following error:
ORA-12505, TNS:listener does notcurrently know of SID given in connect descriptor
通过sqlplus是正常的,上网找到:
https://www.cnblogs.com/pcbaby-ch/p/jdbc-connect-oracle12c-pdb-cdb.html
内容为:
4.3 jdbc连接字符串引发问题: l jdbc连接cdb数据库时,url兼容2种模式: ü "jdbc:oracle:thin:@192.168.75.131:1521:oracle12c" ü "jdbc:oracle:thin:@192.168.75.131:1521/oracle12c" l jdbc连接pdb数据库时url必须使用:" jdbc:oracle:thin:@192.168.75.131:1521/oracle12c"格式,若使用传统格式" jdbc:oracle:thin:@192.168.75.131:1521:oracle12c"则会报一下错误: java.sql.SQLException: Listenerrefused the connection with the following error: ORA-12505, TNS:listener does notcurrently know of SID given in connect descriptor
看到自己的就是pdb(还没有去看资料什么是pdb),按他说的调整为: jdbc:oracle:thin:@xxx.xx.xx.xx:1521/orclpdb
连接正常