Organizational Research By

Surprising Reserch Topic

com mysql jdbc exceptions jdbc4 communicationsexceptioncommunications link fail


com mysql jdbc exceptions jdbc4 communicationsexceptioncommunications link fail  using -'java,mysql,jdbc'

My program that connects to a MySQL database was working fine. Then, without changing any code used to set up the connection, I get this exception:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

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


What happened?

The code used to get the connection:

private static Connection getDBConnection() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException {
    String username = "user";
    String password = "pass";
    String url = "jdbc:mysql://www.domain.com:3306/dbName?connectTimeout=3000";

    Class.forName("com.mysql.jdbc.Driver");
    Connection conn = DriverManager.getConnection(url, username, password);
    return conn;
}

    

asked Sep 15, 2015 by KarolynHKUpg
0 votes
10 views



Related Hot Questions

12 Answers

0 votes
NULL
answered Sep 15, 2015 by QuiFvl
0 votes
NULL
answered Sep 15, 2015 by KeeXUC
0 votes
NULL
answered Sep 15, 2015 by Clyde7222rjm
0 votes
NULL
answered Sep 15, 2015 by LesMyy
0 votes
NULL
answered Sep 15, 2015 by JonathonAJZR
0 votes
NULL
answered Sep 15, 2015 by AidConcepci
0 votes
NULL
answered Sep 15, 2015 by ajit.chavhan
0 votes
NULL
answered Sep 15, 2015 by BerLauer
0 votes
NULL
answered Sep 15, 2015 by LisBrooks
0 votes
NULL
answered Sep 15, 2015 by StaKelly
0 votes
NULL
answered Sep 15, 2015 by JosCottrell
0 votes
NULL
answered Sep 15, 2015 by LenMcEacher

...