javamysqljdbc

JDBC connection error : unrecognized timezone


I getting this error when connect to mysql database with JDBC.

Database.getConnection() Error -->The server time zone value 'EEST' is
unrecognized or represents more than one time zone. You must configure
either the server or JDBC driver (via the serverTimezone configuration 
property) to use a more specifc time zone value if you want to utilize
time zone support.

That is my connection code.

public static Connection getConnection(){
    try {
        Class.forName("com.mysql.jdbc.Driver");

        Connection con = DriverManager.getConnection(
                "jdbc:mysql://localhost:3306/management", "root", "root");
        return con;
    } catch (ClassNotFoundException | SQLException e) {
        // TODO Auto-generated catch block
        System.out.println("Database.getConnection() Error -->"
                + e.getMessage());
        return null;
    }

}

Solution

  • I think there is an issue with the mismatch timezone with MySQL and system.

    So its better to set the value to be in sync.

    You can also refer the below link to set the time: