The hot zone_Grayzone

The hot zone_Grayzone关于这个问题,是在使用Activiti的时候遇到的,如下图:具体内容如下:Causedby:org.apache.ibatis.exceptions.PersistenceException: ###Errorgettinganewconnection. Cause:java.sql.SQLException:Theservertimezonevalue’Öйú±ê…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用



关于这个问题,是在使用Activiti的时候遇到的,如下图:

The hot zone_Grayzone



具体内容如下:

Caused by: org.apache.ibatis.exceptions.PersistenceException: 

### Error getting a new connection.  Cause: 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.
### Cause: 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.
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.getConnection(DefaultSqlSession.java:300)
at org.activiti.engine.impl.db.DbSqlSession.isTablePresent(DbSqlSession.java:1011)
… 38 more
Caused by: 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.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:127)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:87)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:61)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:71)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:862)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:444)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:230)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:226)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:201)
at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:196)
at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection(UnpooledDataSource.java:93)
at org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection(PooledDataSource.java:385)
at org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection(PooledDataSource.java:89)
at org.apache.ibatis.transaction.jdbc.JdbcTransaction.openConnection(JdbcTransaction.java:138)
at org.apache.ibatis.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:60)
at org.apache.ibatis.session.defaults.DefaultSqlSession.getConnection(DefaultSqlSession.java:298)
… 39 more
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: 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.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:59)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:83)
at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:128)
at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2201)
at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2225)
at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1391)
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:993)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:852)

… 52 more



问题分析:

    由错误信息可知:无法检查表是否已经使用元数据显示,在创建表的时候,不能正常连接,在往下看,The server time zone value ,关于这个版本,在Mysql服务的新版中种最为常见,因为我使用的环境为最新的MySLQ社区版8.0.11,在新版的数据库使用的时区与本地时区有区别,标准时区使用的是Unix元年的时间为起始点到当前时间中间所做的动作。国际标准失去与本地相差 8 个小时。


解决办法:

经过上面的问题分析后,该问题的解决办法有两种;

一种:通过修改数据库变量实现,如下图:The hot zone_Grayzone


二种:在连接MySQL服务时,直接指定时区为UTC,即可,将原来的连接

jdbc:mysql://000.000.000.000:3306/etc?useUnicode=true&amp;characterEncoding=utf8

改为现在的:

jdbc:mysql://000.000.000.000:3306/etc?serverTimezone=UTC

更改后如下图:

The hot zone_Grayzone


注意:UTC一定要大写,否则无效!!!

解决完成后,再次连接MySQL数据库服务器,成功连接了,如下图:

The hot zone_Grayzone







好了,关于 java.sql.SQLException: The server time zone value  。。。 就写到这儿了,如果还有什么疑问或遇到什么问题欢迎扫码提问,可以给我留言。
歇后语:“ 共同学习,共同进步 ”,也希望大家多多关注CSND的IT社区。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/184256.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 什么是正则化_lo正则化求解方式

    什么是正则化_lo正则化求解方式COUTCutout[1]是一种新的正则化方法。原理是在训练时随机把图片的一部分减掉,这样能提高模型的鲁棒性。它的来源是计算机视觉任务中经常遇到的物体遮挡问题。通过cutout生成一些类似被遮挡的物体,不仅可以让模型在遇到遮挡问题时表现更好,还能让模型在做决定时更多地考虑环境(context)。Theimplementationofcout1.自己码importtorchimpo…

    2025年12月7日
    5
  • 联想服务器ts系列介绍,联想服务器ThinkServerTS230.ppt「建议收藏」

    联想服务器ts系列介绍,联想服务器ThinkServerTS230.ppt「建议收藏」联想服务器ThinkServerTS230联想在2012年底推出的专为中小型网络应用环境设计的单路塔式服务器——ThinkServerTS230。作为联想ThinkServer服务器家族的入门级产品,ThinkServerTS230在具备极高性价比的同时,亦完美传承了可靠品质、创新引领、全程关怀三大Think基因,具备…

    2022年5月18日
    55
  • LDC1101 LDC1314 LDC1614 1612 线圈感应测试(PCB+源码)

    LDC1101 LDC1314 LDC1614 1612 线圈感应测试(PCB+源码)LDC1101LDC1314LDC16141612线圈感应测试(PCB+源码)www.cirmall.com/circuit/11579

    2022年6月7日
    31
  • python字符串转义字符_python 转义

    python字符串转义字符_python 转义上图中因为python不知到如何处理一对单引号之后的内容,不能识别第三个单引号。(默认都是以一对单引号或双引号来表示字符串从结束到开始。)长字符串:用三个引号(单引号或者双引号)来代表字符串开始和结束例如在有些情况下,就需要用转义:(1)>>>path=’c:\nowhere’输出的内容换行,不是想要的结果,我们就需要转义用反斜杠\来转义…

    2025年8月13日
    6
  • 别怕!MySQL引起的CPU消耗过大,我有办法

    别怕!MySQL引起的CPU消耗过大,我有办法

    2022年2月13日
    44
  • getParameterValues 和 getParameter区别

    getParameterValues 和 getParameter区别一、getParameterValuesrequest.getParameterValues(Stringname)是获得如checkbox类(名字相同,但值有多个)的数据。接收数组变量,如checkobx类型二、getParameterrequest.getParameter(Stringname)是获得相应名的数据,如果有重复的名,则返回第一个的值….

    2022年7月22日
    24

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号