专注于高品质PHP外包、JAVA外包、ASP.NET程序开发、软件开发等信息服务于一体 [STIEMAP] [RSS]

百度提供的广告:
java
当前位置:首页 > 技术文档 > java >  > 
N久么用 Oracle 10G 使用JDBC访问出现以下错误

N久么用 Oracle 10G 使用JDBC访问出现以下错误


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:


localhost:1521:PLSExtPro1c



    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)


    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:260)


    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:386)


    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:413)


    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)


    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34)


    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)


    at java.sql.DriverManager.getConnection(DriverManager.java:582)


    at java.sql.DriverManager.getConnection(DriverManager.java:185)


    at Test.Main.<clinit>(Main.java:18)


解决的方法是:


jdbc:oracle:thin:@localhost:1521:PLSExtProc


PLSExtProc 是默认的数据库id


到 E:\oracle\product\10.2.0\db_1\NETWORK\ADMIN tnsnames.ora


里面就看  SID的值。 (SID = PLSExtProc)