如何解决时区和SSL问题

时间:2019-02-09 16:42:53

标签: java spring hibernate ssl timezone

如果我的应用程序属性如下:

Now is the time; yada yada; th
ing and the thing! Now is the
time; yada yada; thing and the
 thing! Now is the time; yada
yada; thing and the thing! Now
 is the time; yada yada; thing
 and the thing! Now is the tim
e; yada yada; thing and the th
ing! Now is the time; yada yad
a; thing and the thing! Now is
 the time; yada yada; thing an
d the thing!

我得到一个错误:

server.port=8080
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/employees?useSSL=false
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

如果我更改:

java.sql.SQLException: The server time zone value 'rodkowoeuropejski czas stand' 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.

收件人:

spring.datasource.url=jdbc:mysql://localhost:3306/employees?useSSL=false

我明白了:

spring.datasource.url = jdbc:mysql://localhost:3306/CityBikeRental?useLegacyDatetimeCode=false&serverTimezone=UTC

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

我有错误的依赖性,因为:

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

需要此依赖项:

        <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>8.0.15</scope>
    </dependency>

我的版本是8.0.11

时区问题已通过以下行得到解决:

spring.datasource.url=jdbc:mysql://localhost:3306/yourTableName?useLegacyDatetimeCode=false&serverTimezone=UTC