时间戳转换器

youmustconfigureeithertheserverorjdbcdriver(viathe‘servertimezone‘configurationproperty(代码片段)

日期:2022-12-10     来源:闲言博客    作者:闲言博客    浏览:811    java教程

本文目录

1、youmustconfigureeithertheserverorjdbcdriver(viathe‘servertimezone‘configurationproperty(代码片段)

2、activemq学习--002--topic消息例子程序(代码片段)

错误产生环境

SpringBoot项目连接mysql数据库时产生

错误描述

java.sql.SQLException: The server time zone value '�й���׼ʱ��'
 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.

错误原因

这是由于数据库和系统时区差异所造成的,在jdbc连接的url后面加上serverTimezone=GMT

解决办法

在jdbc连接的url后面加上?serverTimezone=GMT

添加前

jdbc:mysql://localhost:3306/springboot

添加后

jdbc:mysql://localhost:3306/springboot?serverTimezone=GMT

activemq学习--002--topic消息例子程序(代码片段)

相关文章

Copyright ©2021 时间戳转换器 小常识 114pp | 陕ICP备18005036号