MySQL JDBC Driver 5.1.33 - Time Zone Issue

前端 未结 30 1197
栀梦
栀梦 2020-11-22 05:22

Some background:

I have a Java 1.6 webapp running on Tomcat 7. The database is MySQL 5.5. Previously, I was using Mysql JDBC driver 5.1.23 to connect to the DB. Ever

30条回答
  •  礼貌的吻别
    2020-11-22 06:06

    You can use the MySQL connector in the Maven dependency,

    
        mysql
        mysql-connector-java
        8.0.14
    
    

    Then you need the set the right parameters in the application.properties file,

    spring.datasource.url=jdbc:mysql://localhost:3306/UserReward?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
    spring.datasource.username=testuser
    spring.datasource.password=testpassword
    # MySQL driver
    spring.datasource.driverClassName=com.mysql.jdbc.Driver
    spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
    

提交回复
热议问题