0

When I tried to connect to my DB from IntelliJ and after I insert to the modules the connector file the Run console wrote to me that issue:

Caused by: java.sql.SQLException: The server time zone value 'Jerusalem Daylight Time' 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.

And this is the code:

Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/login","root","Password");
System.out.println("Connection: " + con.getCatalog());

Thanks.

Thomas Fritsch
  • 9,639
  • 33
  • 37
  • 49
Barel13
  • 40
  • 7

2 Answers2

1

set the mysql server time zone by using below command, and timezone will be as per your region.

SET time_zone='US/Eastern';

or

set time_zone = '-6:00';

it might be solve your problem

Mahamudul Hasan
  • 2,745
  • 2
  • 17
  • 26
0

Specify a timezone supported by MySQL in the connexion URL :

DriverManager.getConnection("jdbc:mysql://localhost:3306/login?serverTimezone=UTC","root","Password");
Thomas Fritsch
  • 9,639
  • 33
  • 37
  • 49
Fabien MIFSUD
  • 335
  • 5
  • 14