JAVA 这是什么问题啊?
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure------解决方案--------------------
客户端发送了数据包,但是没有收到服务器端的任何返回信息,导致无法连接。
主要是检查网络环境,如防火墙、监听端口是否开启、中间的路由等。
可以参考下这里:
http://serverfault.com/questions/89955/unable-to-connect-to-mysql-through-jdbc-connector-through-tomcat-or-externally
------解决方案--------------------
给你的链接里面有5条意见,需要尝试下:
This can happen for a variety of reasons. I just saw it myself a few weeks ago but I can't remember what the fix was for me.
1) Verify the address mysql is bound to, it's probably 127.0.0.1 (only) which I believe is the default (at least on standard Ubuntu server). You'll have to comment out the bind-address parameter in my.cnf to bind to all available addresses (you can't choose multiple, it's one or all).
2) If it is bound to 127.0.0.1 and you can't connect using "localhost", make sure it's not resolving to the IPv6 localhost address instead of IPv4. (or just use the IP address)
3) Double and triple-check the port that mysql is listening on.
4) Make sure you're using the right JDBC connector for your JDK.
5) Make sure you're not doing something really silly like starting mysql with --skip-networking.
I think my first suggestion has the most promise...in fact I think that's where I saw it recently...I was trying to connect to mysql remotely (also on Ubuntu 8.04).
我的异常网推荐解决方案:The driver has not received any packets from the server.,http://www.aiyiweb.com/j2ee/345243.html