C3P0连接池之connct没关闭的坑

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/m0_37776094/article/details/88086472

使用的是 org.springframework.jdbc.core.JdbcTemplate

在c3p0数据源中添加以下配置,检查系统哪里的connect没有关闭

<!-- 超过时间限制是否回收 -->
<property name="removeAbandoned" value="true" />

<!-- 超过时间限;单位为秒。180秒=3分钟 -->
<property name="removeAbandonedTimeout" value="180" />

<!-- 关闭abandoned连接是输出错误日志 -->
<property name="logAbandoned" value="true" />

然后查看日志既可以知道那些connect没有关闭了~~

不能自动关闭Connect确定很坑。。。

猜你喜欢

转载自blog.csdn.net/m0_37776094/article/details/88086472