ORACLE:Io异常:网络适配器无法建立连接

发布于 2024-12-03 00:10:26 字数 1824 浏览 1 评论 0原文

我们偶尔会收到此错误。使用相同的 TNS,我们能够正确连接到数据库。但有时我们在建立连接时会在日志中看到这一点。以下是堆栈跟踪。这是从 Linux 机器和 java 应用程序到 Oracle 的数据库连接,如有任何帮助,我们将不胜感激。

java.sql.SQLException:Io 异常:网络适配器无法建立连接 在 oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) 在 oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) 在 oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255) 在 oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387) 在 oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:439) 在 oracle.jdbc.driver.T4CConnection。(T4CConnection.java:165) 在 oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35) 在 oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801) 在 oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:297) 在 oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:221) 在 oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection (OracleConnectionPoolDataSource.java:157) 在 oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:94) 在 oracle.jdbc.pool.OracleImplicitConnectionCache.makeCacheConnection (OracleImplicitConnectionCache.java:1567) 在 oracle.jdbc.pool.OracleImplicitConnectionCache.getCacheConnection (OracleImplicitConnectionCache.java:478) 在 oracle.jdbc.pool.OracleImplicitConnectionCache.getConnection (OracleImplicitConnectionCache.java:347) 在 oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:404) 在 oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:189) 在 oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:165)

We are getting this error sporadically. With the same TNS, we are able to make proper connections to the database. But we see this in the logs while make connections some times. Following is the stack trace. This is db connection to Oracle from a Linux machine and java application Any help is appreciated.

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:439)
at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:297)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:221)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:157)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:94)
at oracle.jdbc.pool.OracleImplicitConnectionCache.makeCacheConnection(OracleImplicitConnectionCache.java:1567)
at oracle.jdbc.pool.OracleImplicitConnectionCache.getCacheConnection(OracleImplicitConnectionCache.java:478)
at oracle.jdbc.pool.OracleImplicitConnectionCache.getConnection(OracleImplicitConnectionCache.java:347)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:404)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:189)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:165)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

以可爱出名 2024-12-10 00:10:26

尝试以下

  1. (明显) IP 地址不正确 - 尝试 PING
  2. 端口未打开,或被防火墙阻止 - 尝试 TELNET
  3. 数据库侦听器未运行或绑定到不同的网络
    接口 - 再次,TELNET 应该确认这一点(也使用 Oracle 客户端
    连接工具)
  4. 没有本地端口可用于传出连接
    (不太可能)-仅当您建立数千个连接时,或者
    每分钟创建数百个新连接。

try following

  1. (obvious) IP address is incorrect - try PING
  2. The port is not open, or is blocked by a firewall - try TELNET
  3. The DB listener is not running or is binding to a different network
    interface - again, TELNET should confirm this (also use Oracle client
    tools to connect)
  4. No local ports are available for the out-going connection
    (unlikely) - only if you're making thousands of connections, or
    creating hundreds of new connections every minute.
痴骨ら 2024-12-10 00:10:26

似乎连接池耗尽了连接......
当 DBMS 侦听器的传入请求缓冲区因许多同时连接请求而过载时。这会让其中一些人失败。

您可以让线程在连续的连接请求之间休眠一下(半秒到一秒左右)。之后,不要关闭连接,直到它们断开为止。保留它们并重复使用它们。

Seems the connection pool runs out of connections...
When DBMS listener's incoming request buffer is overloaded by many simultaneous connection requests. It will fail some of them.

you can have the thread sleep a bit (half-second to a second or so) between successive connection requests. After that, don't close connections until they're broken. Keep them and re-use them.

黎歌 2024-12-10 00:10:26

检查 https://forums.oracle.com/forums/thread.jspa?messageID= 2540479,也许你必须将listener.ora的文件主机参数更改为你的主机参数。你可以在windows下查看一下你的主机名是什么参数,cmd>hostname

Check https://forums.oracle.com/forums/thread.jspa?messageID=2540479, maybe you must change listener.ora's file host parameter to your host parameter. You can check that what parameter is your hostname in windows, cmd>hostname

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文