使用druid连接池的出现connection泄漏的问题

Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in exam/model/demo.xml.  
--- The error occurred while executing query.  
--- Check the     select * from pagemanage where id=?  .  
--- Check the SQL Statement (preparation failed).  
--- Cause: com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 60000, active 0, maxActive 30, creating 0
        at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201)
        at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:120)
        at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518)
        at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493)
        at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
        at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:270)
        at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:200)
        ... 40 more
Caused by: com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 60000, active 0, maxActive 30, creating 0
        at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1503)
        at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1248)
        at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4619)
        at com.alibaba.druid.filter.FilterAdapter.dataSource_getConnection(FilterAdapter.java:2745)
        at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4615)
        at com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:680)
        at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4615)
        at com.alibaba.druid.filter.FilterAdapter.dataSource_getConnection(FilterAdapter.java:2745)
        at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4615)

问题:客户端连接mysql的连接池中没有存活空闲的连接

处理:

druid.removeAbandoned=true   #超过时间限制是否回收
       druid.removeAbandonedTimeout=300  #超时时间;单位为秒。300秒=5分钟
       druid.logAbandoned=false  #关闭abanded连接时输出错误日志 此配置项会影响性能(true),只在排查的时候打开。系统运行时最好关闭(生产:false)。

你可能感兴趣的:(mysql,mysql,jdbc)