This error message may include the following text also:

“The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.”

When we try to connect to a MySQL server “Communications link failure” error may occur for any of the following errors:

  1. MySQL server is not running. Check for this and run the sever if it is stopped.
  2. Host name is wrong: If the server is running in the same computer, the correct host name is localhost otherwise it is a valid IP address or computer name.
  3. Wrong port no given : By default MySQL server runs in port 3306. If it is different, check that correct port no is given.

 

Sumber : http://java-error-messages.blogspot.com/2011/04/commysqljdbcexceptionsjdbc4communicatio.html