简体   繁体   中英

issues with mysql server timezone and jdbc connection

I am getting this error when connecting to my database.

com.mysql.cj.core.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near '=Australia/Sydney;useSSL=false;'.

this is my connection string:

jdbc:mysql://localhost:3306/mydb?useLegacyDatetimeCode=false;serverTimezone=Australia/Sydney;useSSL=false;

My environment:

  • java 8
  • mysql-connector-java:6.0.6
  • Mysql server community:5.7.18

Any idea what is wrong?

thank you very much

Don't use ; , try: jdbc:mysql://localhost:3306/mydb?useLegacyDatetimeCode=false&serverTimezone=Australia/Sydney&useSSL=false

See https://dev.mysql.com/doc/connector-j/6.0/en/connector-j-reference-jdbc-url-format.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM