mybatis连接报错:the last packet sent successfully to the server was 10008 milliseconds ago

时间: 2023-09-21 22:03:04 浏览: 122
这个错误通常是由于MyBatis连接数据库时出现了超时问题导致的。建议检查以下几点: 1. 确认数据库是否正常运行,可以尝试通过命令行连接数据库来进行测试。 2. 检查MyBatis连接数据库的配置信息是否正确,包括数据库地址、用户名、密码等。 3. 调整MyBatis连接数据库的超时时间,可以在配置文件中设置连接超时时间,例如: ``` <dataSource type="POOLED"> <property name="driver" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/test"/> <property name="username" value="root"/> <property name="password" value="root"/> <property name="poolMaximumActiveConnections" value="100"/> <property name="poolMaximumIdleConnections" value="20"/> <property name="poolMaximumCheckoutTime" value="20000"/> <property name="poolTimeToWait" value="20000"/> </dataSource> ``` 其中 `poolMaximumCheckoutTime` 和 `poolTimeToWait` 分别表示连接池中连接的最长使用时间和等待连接的最长时间,可以根据实际情况进行调整。 希望这些提示能够帮助你解决问题。

相关推荐

springboot+MyBatis连接MySql数据库遇到问题:### Error querying database. Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet successfully received from the server was 11,751 milliseconds ago. The last packet sent successfully to the server was 11,858 milliseconds ago. ### The error may exist in file [/app/tomcat/webapps/project/WEB-INF/classes/mapper/PersonWeekMapper.xml] ### The error may involve com.xmsme.mapper.PersonWeekMapper.selectPersonWeekList-Inline ### The error occurred while setting parameters ### SQL: SELECT count(0) FROM (SELECT WEEK.id, WEEK.sub_time, WEEK.need_thing, WEEK.plan_content, WEEK.target_content, WEEK.sub_time AS update_time, WEEK.create_time, WEEK.week_start, WEEK.user_id, WEEK.week_end, readInfo.id AS readId, readInfo.read_status AS readStatus, updateor.nick_name FROM t_person_weekly AS WEEK LEFT JOIN sys_user sUser ON sUser.user_id = WEEK.user_id LEFT JOIN t_read_info readInfo ON readInfo.business_id = WEEK.id AND readInfo.read_type = 'PER' LEFT JOIN sys_user updateor ON updateor.user_id = WEEK.update_by LEFT JOIN sys_user_role uRole ON uRole.user_id = WEEK.update_by LEFT JOIN sys_user_post uPost ON uPost.user_id = WEEK.user_id LEFT JOIN t_project_person person ON person.user_id = WEEK.user_id LEFT JOIN t_project_person Pperson ON Pperson.project_id = person.project_id WHERE 1 = 1 AND WEEK.is_del = 0 AND WEEK.draft = 'N' AND Pperson.user_id = ? GROUP BY WEEK.id) table_count ### Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet successfully received from the server was 11,751 milliseconds ago. The last packet sent successfully to the server was 11,858 milliseconds ago. ; Communications link failure The last packet successfully received from the server was 11,751 milliseconds ago. The last packet sent successfully to the server was 11,858 milliseconds ago.; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet successfully received from the server was 11,751 milliseconds ago. The last packet sent successfully to the server was 11,858 milliseconds ago.

最新推荐

recommend-type

mybatis中foreach报错:_frch_item_0 not found的解决方法

主要给大家介绍了mybatis中foreach报错:_frch_item_0 not found的解决方法,文章通过示例代码介绍了详细的解决方法,对大家具有一定的参考学习价值,需要的朋友们下面来一起看看吧。
recommend-type

spring boot整合mybatis-plus启动报错问题及解答.pdf

解决spring-boot整合mybatis-plus启动报错问题; Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2020-08-04 20:19:03.246 ERROR 18020 --- ...
recommend-type

使用mybatis-plus报错Invalid bound statement (not found)错误

主要介绍了使用mybatis-plus报错Invalid bound statement (not found)错误,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
recommend-type

MyBatis拦截器:给参数对象属性赋值的实例

下面小编就为大家带来一篇MyBatis拦截器:给参数对象属性赋值的实例。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
recommend-type

mybatis连接MySQL8出现的问题解决方法

主要介绍了mybatis连接MySQL8出现的问题解决方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

MATLAB柱状图在信号处理中的应用:可视化信号特征和频谱分析

![matlab画柱状图](https://img-blog.csdnimg.cn/3f32348f1c9c4481a6f5931993732f97.png) # 1. MATLAB柱状图概述** MATLAB柱状图是一种图形化工具,用于可视化数据中不同类别或组的分布情况。它通过绘制垂直条形来表示每个类别或组中的数据值。柱状图在信号处理中广泛用于可视化信号特征和进行频谱分析。 柱状图的优点在于其简单易懂,能够直观地展示数据分布。在信号处理中,柱状图可以帮助工程师识别信号中的模式、趋势和异常情况,从而为信号分析和处理提供有价值的见解。 # 2. 柱状图在信号处理中的应用 柱状图在信号处理
recommend-type

用Spring boot和vue写一个登录注册界面

好的,这是一个比较常见的技术问题,我可以为您提供一些参考资料和思路。首先,您可以使用Spring Boot作为后端框架来处理用户认证和注册的逻辑,比如使用Spring Security实现用户登录认证。同时,您还需要设计相应的数据模型和数据库表结构来存储用户信息。在前端方面,您可以使用Vue.js作为框架来构建登录注册页面,使用Axios来发起API请求并和后端进行交互。当然,在实现过程中,还需要考虑一些具体细节,比如数据校验、安全性和用户体验等方面。希望这些信息能够帮助到您。
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。