微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

mysql连接出现问题记录

解决:Caused by: com.MysqL.cj.exceptions.InvalidConnectionAttributeException: The server time zone valu

//报错信息
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(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.MysqL.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
    at com.MysqL.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
    at com.MysqL.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132)
    at com.MysqL.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2241)
    at com.MysqL.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2265)
    at com.MysqL.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1319)
    at com.MysqL.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:966)
    at com.MysqL.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)
    ... 6 more

此问题为时区问题,在 JDBC 的连接 url 部分加上 serverTimezone=UTC 即可。
如图:

解决:Loading class `com.MysqL.jdbc.Driver'. This is deprecated. The new driver class is `com.MysqL.cj.jdb

 

措施:现在按照最新官方提示支持将com.MysqL.jdbc.Driver  改为  com.MysqL.cj.jdbc.Driver

提示:并不是修改maven中对于数据库加载驱动的以来名称 <artifactId>

driver = "com.MysqL.jdbc.Driver";
//更改为
driver = "com.MysqL.cj.jdbc.Driver";
//报错即可消失

 

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

相关推荐