一些背景:
我有一个在 Tomcat 7 上运行的 Java 1.6 webapp。数据库是 MySQL 5.5。以前,我使用 Mysql JDBC 驱动程序 5.1.23 连接到数据库。一切正常。我最近升级到 Mysql JDBC 驱动程序 5.1.33。升级后,Tomcat在启动应用时会抛出这个错误。
WARNING: Unexpected exception resolving reference
java.sql.SQLException: The server timezone value 'UTC' is unrecognized or represents
more than one timezone. You must configure either the server or JDBC driver (via
the serverTimezone configuration property) to use a more specifc timezone value if
you want to utilize timezone support.
为什么会这样?
最佳答案
显然,要使 MySQL JDBC 驱动程序版本 5.1.33 与 UTC 时区一起工作,必须在连接字符串中明确指定 serverTimezone
。
jdbc:mysql://localhost/db?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
关于java - MySQL JDBC 驱动程序 5.1.33 - 时区问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26515700/