简体   繁体   English

将 java 与 Oracle 18c 连接时出现 JDBC 错误

[英]JDBC error while connecting java with Oracle 18c

I am getting below error when I am connecting Oracle 18c database with java.当我使用 java 连接 Oracle 18c 数据库时出现以下错误。 The command I am using.我正在使用的命令。

Class.forName("oracle.jdbc.driver.OracleDriver"); 
        Connection con=DriverManager.getConnection("jdbc:oracle:thin:@100.100.209.28:1521:PDB1","cmiapps","WEXXXX##");

Error I am getting.我得到的错误。

Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

When I am running below query I am getting PDB1 as service name.当我在查询下运行时,我将PDB1作为服务名称。

select name from dba_services;

Could you please help me on the same?你能帮我吗?

As mentioned in comment by @thatjeffsmith , you can not use SID to connect with PDB database.正如@thatjeffsmith 在评论中提到的,您不能使用SID连接PDB数据库。 you will have to use service name for the same.您将不得不使用service name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM