gpt4 book ai didi

java - 通过 Spring Boot 连接 mysql 时出现时区问题,相当于 Mitteleuropäische Zeit

转载 作者:行者123 更新时间:2023-12-02 01:03:06 24 4
gpt4 key购买 nike

当我尝试连接 mysql 时遇到以下错误:

Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Mitteleuropäische Zeit' 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.

为了收到下面的问题,我已经浏览了MySQL JDBC Driver 5.1.33 - Time Zone Issue

我正在使用下面的 mysql 连接器:

mysql mysql-连接器-java 8.0.11

应用程序属性如下:

db2.datasource.url=jdbc:mysql://www<><>06/esystem?useSSL=false&zeroDateTimeBehavior=convertToNull&useUnicode=trueuseLegacyDatetimeCode=false&serverTimezone=GMT+1

我已经使用 CET 和 GMT+1 代替 serverTimezone,但没有运气。任何解决点,什么可以是“Mitteleuropäische Zeit”的时区占位符

最佳答案

this question中所示,你应该使用IANA timezone formats ,例如欧洲/柏林:

db2.datasource.url=jdbc:mysql://www<><>06/esystem?useSSL=false&zeroDateTimeBehavior=convertToNull&useUnicode=trueuseLegacyDatetimeCode=false&serverTimezone=Europe/Berlin

关于java - 通过 Spring Boot 连接 mysql 时出现时区问题,相当于 Mitteleuropäische Zeit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60411307/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com