java.sql.SQLException:网络错误IOException:没有到主机的路由?

时间:2014-03-12 09:26:45

标签: java sql jdbc driver sqlexception

14:51:34,652 DEBUG [mchange.v2.resourcepool.BasicResourcePool         ] - An exception occurred while acquiring a poolable resource. Will retry.
java.sql.SQLException: Network error IOException: No route to host: connect
    at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:436)
    at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
    at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
    at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Caused by: java.net.NoRouteToHostException: No route to host: connect
    at java.net.DualStackPlainSocketImpl.connect0(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 net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:288)
    at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:251)
    at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:331)

任何人都可以告诉我:

如何解决此问题?

3 个答案:

答案 0 :(得分:1)

这是因为你找回了ICMP&#34;目标主机无法访问&#34;消息(类型3,代码1)。

这意味着其中任何一件事:

  • 您在路由表中没有到目的地主机的路由(或者您使用的路由器没有路由器);
  • 防火墙会将此消息发回给您。

在第一种情况下,如果可以,请修复路线(可能您忘记启动VPN?)。在第二种情况下,请问防火墙管理员为什么会这样(幸运的是,他/她不会回答你&#34;因为是&#34;但是给你一个真正的理由:p)

答案 1 :(得分:0)

如果未连接到服务器,可能会发生这种情况。尝试ping它以确保。

答案 2 :(得分:0)

检查iptables服务是否已停止。 “service iptables status”

通过以下命令从您的系统验证, “telnet server_ip 3306”

参考:https://community.oracle.com/thread/1335778?start=0