ORA-12505,TNS:监听器当前不知道连接描述符中给出的SID

时间:2016-12-26 07:14:47

标签: java oracle jdbc

连接代码:

Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "USER_NAME", "PASSWORD";

例外:

  

线程中的异常" main" java.sql.SQLException:监听器拒绝了   连接以下错误:ORA-12505,TNS:监听器没有   目前知道连接描述符中给出的SID

     

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:419)at at   oracle.jdbc.driver.PhysicalConnection。(PhysicalConnection.java:536)     在oracle.jdbc.driver.T4CConnection。(T4CConnection.java:228)     在   oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)     在oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)at   java.sql.DriverManager.getConnection(DriverManager.java:571)

1 个答案:

答案 0 :(得分:0)

<强>解决:

改变&#39; orcl&#39;在连接字符串中使用&#39; XE&#39;。