一些背景:
我有一个在 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.
为什么会这样?
原文由 bluecollarcoder 发布,翻译遵循 CC BY-SA 4.0 许可协议
显然,要让 5.1.33 版的 MySQL JDBC 驱动程序使用 UTC 时区,必须在连接字符串中明确指定
serverTimezone
。