Reputation: 3
I got the error
Error:java.sql.SQLException: The server time zone value 'Malay Peninsula Standard Time' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the server timezone configuration property) to use a more specific time zone value if you want to utilize time zone support. java.lang.NullPointerException
I tried changing my computer's time with our local timezone but still the same error.
I tried adding my connection:
"jdbc:mysql://localhost/db?useUnicode=true&useJDBCCompliatnTimezoneShift=true&useLegacyDatetimeCode=false","root",""
still no work and i got the error:
Error:java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near ';useJDBCCompliatnTimezoneShift=true&useLegacyDatetimeCode=false'. java.lang.NullPointerException
My connection string is:
Class.forName("com.mysql.cj.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/raqs","root","");
Upvotes: 0
Views: 1375
Reputation: 3
To solve my problem:
I have only added serverTimezone=UTC
to my URL. And to be very careful in declaring a query which is case sensitive. And make sure in declaring variables in String or in Int and etc.
My codes worked well already and successfully connected my database to the eclipse ^_^
Upvotes: 0
Reputation: 102795
Fix your typo. It's 'compliant', not 'compliatn'. Just like the error says.
Upvotes: 1