开发者社区> 问答> 正文

MySQL JDBC驱动程序5.1.33-时区问题

一些背景:

我在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. 为什么会这样呢?

展开
收起
保持可爱mmm 2020-05-10 19:31:06 768 0
1 条回答
写回答
取消 提交回答
  • 显然,要使MySQL JDBC驱动程序5.1.33版与UTC时区一起使用,必须serverTimezone在连接字符串中显式指定。

    jdbc:mysql://localhost/db?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC 分享来源:stack overflow

    2020-05-10 19:31:21
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
搭建电商项目架构连接MySQL 立即下载
搭建4层电商项目架构,实战连接MySQL 立即下载
PolarDB MySQL引擎重磅功能及产品能力盛大发布 立即下载

相关镜像