解决mysql中数据库连接connection holder is null的问题
一。问题频繁查询或者更新数据库时,出现以下问题报错:Cause: java.sql.SQLException: connection holder is null二。解决方法在application.xml配置文件中加入以下配置:spring:datasource:# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒timeBetweenEvictionRunsMillis: 600
·
一。问题
频繁查询或者更新数据库时,出现以下问题报错:
Cause: java.sql.SQLException: connection holder is null
二。解决方法
在application.xml配置文件中加入以下配置:
spring:
datasource:
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
#是否自动回收超时连接
removeAbandoned: true
#超时时间(以秒数为单位)
removeAbandonedTimeout: 1800
配置间隔多久才进行一次检测需要关闭的空闲连接,加大超时时间以及是否自动回收超时连接:
更多推荐




所有评论(0)