升级 mysql-connector 5 到 8 遇到的问题

升级mysql-connector 5到8遇到的问题

本文转自 http://mangocool.com/1535426841921.html

  以下是我升级 mysql-connector 从 5.1.46 到 8.0.11 时遇到的问题 :

1、Establishing SSL connection without server’s identity verification is not recommend

  解决办法:在 mysql 连接字符串 url 中加入ssl=true或者false即可,如下:

	 url=jdbc:mysql://xxx.xxx.xxx.xxx:3306/xxx?characterEncoding=utf8&useSSL=true

参考:https://blog.csdn.net/guoweimelon/article/details/50810399

2、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.

  解决办法:在 mysql 连接字符串 url 中加入 serverTimezone=UTC 即可,如下:

	url=jdbc:mysql://xxx.xxx.xxx.xxx:3306/xxx?characterEncoding=utf8&useSSL=true&serverTimezone=UTC

参考:https://blog.csdn.net/yefengzhichen/article/details/51834511

3、java.sql.SQLException: The connection property ‘zeroDateTimeBehavior’ acceptable values are: ‘CONVERT_TO_NULL’, ‘EXCEPTION’ or ‘ROUND’. The value ‘convertToNull’ is not acceptable.
java.lang.IllegalArgumentException: No enum constant com.mysql.cj.conf.PropertyDefinitions.ZeroDatetimeBehavior.CONVERTTONULL

  解决办法:由于 MySql 废弃了 convertToNull 该写法,改为 CONVERT_TO_NULL

	url=jdbc:mysql://xxx.xxx.xxx.xxx:3306/xxx?characterEncoding=utf8&useSSL=true&serverTimezone=UTC&zeroDateTimeBehavior=CONVERT_TO_NULL

  参考:https://blog.csdn.net/qq_32454537/article/details/80109800

4、 Exception in thread “main” org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]
Offending resource: class path resource [spring-mybatis.xml]

  参考:http://chenzhou123520.iteye.com/blog/1971322

5、Caused by: java.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver : Unsupported major.minor version 52.0

  解决办法:mysql8 依赖jdk1.8,升级jdk

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值