码迷,mamicode.com
首页 > 其他好文 > 详细

ssh报错No operations allowed after connection closed.Connection was implicitly clos

时间:2020-01-20 19:23:22      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:rop   manage   val   使用   connect   not   nec   max   超过   

### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

网上查了下,由于使用了默认配置,空闲超过8小时,自动断开该连接

我使用的是mybatis的默认连接池,于是把该配的,都配置上。datasource的属性,可参考mybatis官方文档

        <environment id="env_stg">
            <transactionManager type="JDBC" />
            <dataSource type="POOLED">
                <property name="driver" value="${driver}" />
                <property name="url" value="${url_stg}" />
                <property name="username" value="${username}" />
                <property name="password" value="${password}" />
                <property name="poolMaximumActiveConnections" value="20"/>
                <property name="poolMaximumIdleConnections" value="5"/>
                <!-- MySQLNonTransientConnectionException: No operations allowed after connection closed -->
                <property name="poolPingQuery" value="select 1"/>
                <property name="poolPingEnabled" value="true"/>
                <!-- 对于空闲的连接一个小时检查一次 -->
                <property name="poolPingConnectionsNotUsedFor" value="3600000"/>
            </dataSource>
        </environment>

技术图片

ssh报错No operations allowed after connection closed.Connection was implicitly clos

标签:rop   manage   val   使用   connect   not   nec   max   超过   

原文地址:https://www.cnblogs.com/qianzf/p/12218953.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!