书单推荐:成为Java顶级程序员架构师 ,这20来本(高薪)必看点击获取
主机IP地址不正确或者网络不通
提示的错误信息如下:
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.ConnectException
MESSAGE: Connection timed out: connect
STACKTRACE:
java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:132)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:273)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1639)
at com.mysql.jdbc.Connection.<init>(Connection.java:393)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:262)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at test.JDBCTest.oracleTest(JDBCTest.java:25)
at test.JDBCTest.main(JDBCTest.java:12)
** END NESTED EXCEPTION **
解决方法:查看IP地址是否正确,网络是否有问题。
转载请注明:谷谷点程序 » com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception