1、oracle中一个存储过程收集数据,然后保存至out游标。
2、通过spring调用该存储过程,并返回数据。
3、逻辑处理类继承自StoredProcedure。
4、当游标数据超过连接池指定大小后连接池就爆了。
/*
*在spring调用存储过程的代码中,自始至终没见到有需要控制连接池的地方,比如open和close。
*/
---------------------以下是连接池配置相关参数--------------------------
maxActive=50
maxWait=20000
maxIdle=5
---------------------以下是报错信息-----------------------------------
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:103)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:392)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:333)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1109)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.springframework.orm.hibernate3.HibernateTemplate$31.doInHibernate(HibernateTemplate.java:853)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)
... 82 more
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:801)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)
spring will control the open and close of the connection pool itself.
Normally speaking, cursor data has nothing to do with the connection pool size. It should be a code problem, check the code carefully.
It is really not possible to call the stored procedure directly from jdbc. Manually control the opening and closing of connections.