2016-12-26 73 views
0

連接代碼:ORA-12505,TNS:監聽器目前不知道SID的連接描述符中給出

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

例外:

Exception in thread "main" 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

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

+0

什麼是數據庫實例的SID? – GurV

+0

你連接你的數據庫與anytool? –

回答

0

解決:

將連接字符串中的'orcl'更改爲'XE'。

相關問題