MySQL database driver 8.0.9-rc version of mysql-connector-java to connect to MySQL database

  Before, my MySQL database driver mysql-connector-java version number was 5.1.34. After upgrading to version 8.0.9-rc, I found that the original connection method reported an error. Therefore, record the connection usage of the new version of MySQL database driver here.

  First post the connection method of the previous old version (5.1.34):

db.driverClassName=com.mysql.jdbc.Driver
db.url=jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=utf8&useSSL=true

  The connection method of the upgraded new version is as follows:

db.driverClassName=com.mysql.cj.jdbc.Driver
db.url=jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=utf8&useSSL=true&serverTimezone=GMT

  Here, there are two main modifications made after the upgrade:

  • First, the database-driven connection address has been com.mysql.jdbc.Driverupgraded from the previous one com.mysql.cj.jdbc.Driver.
  • Second, add the time zone to the url address of the database at the end, that is, add it &serverTimezone=GMT.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324579341&siteId=291194637