当我将Oracle 18c数据库与Java连接时,我遇到错误。我正在使用的命令。
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@100.100.209.28:1521:PDB1","cmiapps","WEXXXX##");
我得到的错误。
Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
当我在查询下运行时,我将PDB1
作为服务名称。
select name from dba_services;
您能帮我吗?
如@thatjeffsmith在评论中所述,您不能使用SID
与PDB
数据库连接。您必须同样使用service name
。