栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

使用Mybatis逆向工程时报错:java.sql.SQLException: Unknown system variable ‘query

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用Mybatis逆向工程时报错:java.sql.SQLException: Unknown system variable ‘query

使用Mybatis逆向工程创建javaBean、dao以及相应的映射mapper文件时报错:
Unknown system variable 'query_cache_size’

原因是mysql-connecter-java的版本过低,是数据库驱动程序与数据库版本不对应,根据官方的说法是 :
The query cache is deprecated as of MySQL 5.7.20, and is removed in MySQL 8.0. Deprecation includes query_cache_size.
意思是query cache在MySQL5.7.20就已经过时了,而在MySQL8.0之后就已经被移除了。
将maven依赖的jar包改成更高版本的:


            mysql
            mysql-connector-java
            8.0.11
        

运行后报错:
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.

是因为jdbcUrl的时区未设置,原url为:

jdbc.jdbcUrl=jdbc:mysql://localhost:3306/ssm_crud?useUnicode=true&characterEncoding=utf-8

修改为:

jdbc.jdbcUrl=jdbc:mysql://localhost:3306/ssm_crud?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC

运行报错:
javax.net.ssl.SSLException: closing inbound before receiving peer’s close_notify

解决方法:在配置文件中,配置连接数据库的url时,加上useSSL=false

修改后的url:

```c
jdbc.jdbcUrl=jdbc:mysql://localhost:3306/ssm_crud?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=false

最后运行成功,不报错!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/723952.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号