Error querying database. Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet successfully received from the server was 14,465,416 milliseconds ago. The last packet sent successfully to the server was 14,465,418 milliseconds ago.

The error may exist in file [D:\IdeaProjects2017\IdeaProjects\demo\target\classes\mapper\UserDao.xml]

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL: SELECT user.id,user_no,user_name,login_no,password,user.grade,user_rfid, user_id_no,wechat_no,sex,user.phone_no,picture,user.organization_no,user.organization_name, user.address,post,borrow_number,borrow_day,integral,state,validity_date,user.remarks, operator,createup_date FROM user,organization WHERE user.organization_no=organization.organization_no and user.user_no=?

Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

解决方法在配置文件properites中添加`

#下面这两个配置,可以在每次连接的时候判断一些连接是否有效
spring.datasource.druid.test-on-borrow=true
spring.datasource.druid.test-while-idle=true

或者改变tomcat的配置连接时间,这个不建议改tomcat配置文件

Logo

一站式 AI 云服务平台

更多推荐