Organizational Research By

Surprising Reserch Topic

Experts Most Trusted 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
9 views



Related Hot Questions



Government Jobs Opening


...