启动tomcat时mysql连接不上服务器
我这机器有点怪.也不知道是什么原因.用jdbc去连mysql服务器的时候反正在以下三种情形会有三种结果:
a:如果我这台机器不让他接上路由器或局域网,提示:
01:04:00,453 WARN SettingsFactory:109 - Could not obtain connection metadata
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.NoRouteToHostException: No route to host: connect
b:如果我这台机器接上局域网,提示:(之前我用的另一家公司提供的宽带服务,机器接上网络后jdbc能正常连接服务器.)
23:59:28,921 WARN SettingsFactory:109 - Could not obtain connection metadata
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.ConnectException: Connection timed out: connect
c:如果我这台机器接上我自己弄的一个猫(电开着),则能够正常连上服务器
我现在想要的结果是在各种情况下我本机的应用都可通过jdbc提供的驱动去访问mysql服务器.还期望各位提供一个好的解决方案.