【发布时间】:2017-03-20 06:11:06
【问题描述】:
我正在尝试通过 JDBC 连接到数据库
Class.forName("oracle.jdbc.driver.OracleDriver");
String url="jdbc:oracle:thin:@host_name:port:service_name"; //Changed the host_name, port and service_name for confidentiality
String username = "user_name"; // Changed the user_name
String password = "my_password"; //Changed the password
Connection conn = DriverManager.getConnection(url, username, password);
得到以下异常
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
但同时,我可以通过 Oracle SQL 开发人员进行连接。
注意-我的 service_name 由“.”组成和“_”,我的主机名包含“。”
请在这里帮忙!
【问题讨论】:
标签: sql eclipse jdbc oracle-sqldeveloper