连接到Oracle数据库时遇到java.sql.SQLException

时间:2020-12-24 22:51:44

I get the following error when I try to run my project:

我尝试运行项目时收到以下错误:

java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=169870080)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4)))) 

Any ideas?

2 个解决方案

#1


You're getting an ORA-12505 error ("TNS: listener could not resolve SID given in connection description."). This happens when the SID (System ID) of the database you wish to connect to isn't registered with Oracle's listener. If you can find the JDBC connection information, you may find something that matches this pattern:

您收到ORA-12505错误(“TNS:侦听器无法解析连接描述中给出的SID。”)。当您希望连接的数据库的SID(系统ID)未向Oracle的侦听器注册时,会发生这种情况。如果您可以找到JDBC连接信息,您可能会发现与此模式匹配的内容:

jdbc:oracle:thin:[user]/[password]@[host]:[port]:[sid]

In this case, Oracle is telling you that [sid] does not exist on the server [host]. You may be connecting to the wrong server.

在这种情况下,Oracle告诉您服务器[host]上不存在[sid]。您可能连接到错误的服务器。

#2


Connection refused means that the server is not allowing your client to connect. Double check the server settings and make sure your host is allowed to connect, at the very least.

连接被拒绝意味着服务器不允许客户端连接。仔细检查服务器设置,确保您的主机至少可以连接。

#1


You're getting an ORA-12505 error ("TNS: listener could not resolve SID given in connection description."). This happens when the SID (System ID) of the database you wish to connect to isn't registered with Oracle's listener. If you can find the JDBC connection information, you may find something that matches this pattern:

您收到ORA-12505错误(“TNS:侦听器无法解析连接描述中给出的SID。”)。当您希望连接的数据库的SID(系统ID)未向Oracle的侦听器注册时,会发生这种情况。如果您可以找到JDBC连接信息,您可能会发现与此模式匹配的内容:

jdbc:oracle:thin:[user]/[password]@[host]:[port]:[sid]

In this case, Oracle is telling you that [sid] does not exist on the server [host]. You may be connecting to the wrong server.

在这种情况下,Oracle告诉您服务器[host]上不存在[sid]。您可能连接到错误的服务器。

#2


Connection refused means that the server is not allowing your client to connect. Double check the server settings and make sure your host is allowed to connect, at the very least.

连接被拒绝意味着服务器不允许客户端连接。仔细检查服务器设置,确保您的主机至少可以连接。