DBCP连接属性(DBCP Connection properties)

2019-09-17 00:33发布

我们有很难搞清楚的属性定义 , minIdlemaxIdle等。

我们看到以下设置的以下错误

InitialSize=5
maxActive=50
maxIdle=40
maxWait=2000
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1001)
    at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1064)

    ... 36 more
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
    at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource.getConnection(AbstractRoutingDataSource.java:148)
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
    ... 39 more
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
    at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1134)
    at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)

Answer 1:

这是解决。 这个问题是从坏的应用程序代码连接泄漏。 应用程序代码被写入访问使用Oracle数组类型底层的本地连接和管理不当。 改变了代码使用SimpleNativeJdbcExtractor

http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/jdbc/support/nativejdbc/SimpleNativeJdbcExtractor.html



文章来源: DBCP Connection properties