0

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","");
5
  • Is an instance of MySQL actually running when you try this? Did you configure it to listen on local host and on port 3306? Can you show us how you configured MySQL networking so we can verify that it's running correctly? Commented Sep 13, 2018 at 3:06
  • What version of MySQL are you using? Commented Sep 13, 2018 at 3:11
  • I have tried connecting MySQL database with a php code and I can access the database in my local host Commented Sep 13, 2018 at 3:17
  • Im using XAMPP Control Panel v3.2.2 Commented Sep 13, 2018 at 3:17
  • Im using mysql-connector-java-8.0.12 for connection Commented Sep 13, 2018 at 15:06

2 Answers 2

1

Fix your typo. It's 'compliant', not 'compliatn'. Just like the error says.

Sign up to request clarification or add additional context in comments.

1 Comment

Fixed it but still an 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 serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support. java.lang.NullPointerException
0

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 ^_^

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.