ORA-12505,TNS:监听器当前不知道连接描述符中给出的SID我在Windows 7 64位操作系统中安装了Oracle 11g Express Edition Release 2并试图执行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
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.jlcindia.jdbc.JDBCUtil.geOracleConnection(JDBCUtil.java:28)
at Lab3O.main(Lab3O.java:15)Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:385)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
... 8 more
3 回答
心有法竹
TA贡献1866条经验 获得超5个赞
我通过纠正我的jdbc字符串修复了这个问题。
例如,正确的jdbc字符串应该是......
jdbc:oracle:thin:@myserver:1521/XE
但是我使用的jdbs字符串是......
jdbc:oracle:thin:@myserver:1521:XE
(注意:之间1521
和XE
应该是/
)
这个错误的jdbc字符串也给我一个ORA-12505错误。
呼如林
TA贡献1798条经验 获得超3个赞
我也得到了同样的错误但是当他们尝试了所有这三个失败时。如果以上三个失败。如果你发现服务(我的情况下是XE)丢失,请尝试LSNRCTL状态试试这个 现在你可以看到服务 即使看不到尝试这个sqlplus /nolog
conn system ... password ...
connected.
alter system register;
exit
lsnrctl stat
...sqlplus /nolog
conn system
... password ... connected.
alter system set local_listener = '(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))' scope = both;
... system altered ...
alter system register;
exit
lsnrctl stat
这应该可行......
- 3 回答
- 0 关注
- 5612 浏览
添加回答
举报
0/150
提交
取消