gpt4 book ai didi

oracle - ORA-12505,TNS :listener does not currently know of SID given in connect descriptor

转载 作者:行者123 更新时间:2023-12-03 04:26:25 29 4
gpt4 key购买 nike

我在 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

最佳答案

我通过更正 jdbc 字符串解决了此问题。

例如,正确的 jdbc 字符串应该是...

jdbc:oracle:thin:@myserver:1521/XE

但是我使用的 jdbs 字符串是...

jdbc:oracle:thin:@myserver:1521:XE

(注意:1521XE之间应该是/)

这个错误的 jdbc 字符串也会给我一个 ORA-12505 错误。

关于oracle - ORA-12505,TNS :listener does not currently know of SID given in connect descriptor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18192521/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com