gpt4 book ai didi

java - 无法连接到 Oracle 数据库 : java. sql.SQLRecoverableException

转载 作者:行者123 更新时间:2023-12-01 10:51:38 26 4
gpt4 key购买 nike

无法连接到 Oracle 数据库。数据库正在运行,当我尝试从 Eclipse ping 数据库时出现以下错误。

java.sql.SQLRecoverableException: I/O-Fehler: 
The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:478)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:547)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:225)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:29)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:556)
at oracle.eclipse.tools.database.connectivity.db.OracleJDBCConnection.createConn(OracleJDBCConnection.java:193)
at oracle.eclipse.tools.database.connectivity.db.OracleJDBCConnection.createConnection(OracleJDBCConnection.java:149)
at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:105)
at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:54)
at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:96)
at oracle.eclipse.tools.database.connectivity.db.OracleJDBCConnectionFactory.createConnection(OracleJDBCConnectionFactory.java:26)
at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)
at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:359)
at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)
at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:372)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:419)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:873)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:258)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1577)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:353)
... 15 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:206)
at oracle.net.nt.ConnOption.connect(ConnOption.java:120)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:350)
... 20 more

配置如下:

This is the configuration

我对 Oracle 数据库完全陌生。那么如何解决这个问题呢?

最佳答案

底层异常是这样的:

Caused by: java.net.ConnectException: Connection refused: connect

这意味着没有任何内容监听数据库连接。一些可能的解释是:

  • 您连接到了错误的主机。
  • 您使用了错误的端口
  • 数据库目前未运行
  • 防火墙阻止您的访问,并“拒绝”连接。

我注意到您已将主机设置为“localhost”。仅当您的 Java 客户端与数据库在同一主机上运行时,这才有效。

关于java - 无法连接到 Oracle 数据库 : java. sql.SQLRecoverableException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33842977/

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