Sorry Eric, i would not confuse you :) if have different functions to execute PreparedStatements I am using oc4j and the struts config was the easiest and quickest way to provide a clean access to the database i thought. Trying your configuration i have to adopt my source to access the datasource via jndi, because the struts config can not handle the DataSourceFactory. :(
Okay, i will try it and keep you informed. Thank you anyway for your help and your informations Regards Mirko Mit freundlichen Grüßen Mirko Wolf ----------------------------------------------------------------------------------------------------------------------------------------- panta rhei systems gmbh budapester straße 31 10787 berlin tel +49.30.26 01-14 17 fax +49.30.26 01-414 13 [EMAIL PROTECTED] www.panta-rhei.de Diese Nachricht ist vertraulich und ausschliesslich für den Adressaten bestimmt. Jeder Gebrauch durch Dritte ist verboten. Falls Sie die Daten irrtuemlich erhalten haben, nehmen Sie bitte Kontakt mit dem Absender auf und loeschen Sie die Daten auf jedem Computer und Datentraeger. Der Absender ist nicht verantwortlich für die ordnungsgemaesse, vollstaendige oder verzoegerungsfreie Übertragung dieser Nachricht. This message is confidential and intended solely for the use by the addressee. Any use of this message by a third party is prohibited. If you received this message in error, please contact the sender and delete the data from any computer and data carrier. The sender is neither liable for the proper and complete transmission of the information in the message nor for any delay in its receipt. >>> [EMAIL PROTECTED] 08/25 1:01 >>> Well, I am a little confused that the first piece of code you included invokes an executeStatement method that takes a String parameter, but the second piece of code shows an executeStatement method that takes a List parameter. But, I assume there is another, similar, executeStatement method, that takes a String parameter. Your code looks good to me, I should have looked at it more closely before I responded. Here is the data source configuration in my Tomcat xml config file (${catalina_home}/conf/Catalina/localhost/MyWar.xml): <Resource name="jdbc/OracleDB" auth="container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/OracleDB"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>driverClassName</name> <value>oracle.jdbc.driver.OracleDriver</value> </parameter> <parameter> <name>url</name> <value>jdbc:oracle:thin:@myhost:1521:mydbinstance</value> </parameter> <parameter> <name>username</name> <value>eweber</value> </parameter> <parameter> <name>password</name> <value>changeit</value> </parameter> <parameter> <name>maxActive</name> <value>20</value> </parameter> <parameter> <name>maxIdle</name> <value>10</value> </parameter> <parameter> <name>maxWait</name> <value>-1</value> </parameter> </ResourceParams> This is with Oracle 10. I don't use the struts data source configuration but rather use Tomcat's and just do a JNDI lookup on the DataSource at startup, caching the DataSource reference to use from then on. But perhaps some of those other parameters that you configure could lead to a problem (I have no evidence of this). http://www.junlu.com/msg/46934.html http://www.cryer.co.uk/brian/oracle/SYMdilu.htm#RemedySharedPoolExhausted Maybe try my param set, maybe try my version of DBCP if it is different from yours. Erik PANTA-RHEI WOLF wrote: >Hi there, i have a very strange behaviour using DBCP. I have a small set of JSPs >talking to an oracledatabase. after a while >it looks if my application hang. 2 till 3 minutes later it seems to work fine again. >When i have a look in my logfile, i can see >the following exception. I do not know what happen exactly, can anyone help me please? > >Below you is the Exception, the datasource-config and a snippet from my application. > >Is it correct closing each connection after using it? > >Thank you in advance > >Mirko > > > >The Exception is the following: > >04/08/24 15:51:59 org.apache.commons.dbcp.SQLNestedException: Cannot get a >connection, pool exhausted 04/08/24 15:51:59 at >org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:103) >04/08/24 15:51:59 at >org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) >04/08/24 15:51:59 at >de.orb.quick.model.CommunicationLayer.executeStatement(CommunicationLayer.java:86) >04/08/24 15:51:59 at >de.orb.quick.model.TreeDataBean.getResult(TreeDataBean.java:57) 04/08/24 15:51:59 >at _javascript._jspService(javascript.jsp:12) > ... bla bla bla... 04/08/24 15:51:59 at >com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192) > 04/08/24 15:51:59 at java.lang.Thread.run(Thread.java:534) 04/08/24 15:51:59 >Caused by: java.util.NoSuchElementException: Timeout waiting for idle object 04/08/24 >15:51:59 at >org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:756) > 04/08/24 15:51:59 at >org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:74) >04/08/24 15:51:59 at >org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95) >04/08/24 15:51:59 ... 62 more > >The datasource Configuration in struts-config.xml: > > <data-source type="org.apache.commons.dbcp.BasicDataSource"> > <set-property property="driverClassName" > value="oracle.jdbc.driver.OracleDriver" /> > <set-property property="url" value="jdbc:oracle:thin:@host:1521:SID" /> > <set-property property="username" value="user" /> > <set-property property="password" value="pass" /> > <set-property property="initialSize" value="5" /> > <set-property property="maxActive" value="40" /> > <set-property property="maxIdle" value="5" /> > <set-property property="testOnBorrow" value="true" /> > <set-property property="maxWait" value="120000" /> > <set-property property="defaultAutoCommit" value="false" /> > <set-property property="validationQuery" value="select sysdate from dual" /> > <set-property property="removeAbandoned" value="true" /> > </data-source> > > >the application snippet: >// ----------------------------------------------------------------- > public ArrayList getResult(UserBean userBean) { > ArrayList data = new ArrayList(); > ResultSet rset = null; > int counter = 0; > > try { > rset = executeStatement( "my sql statement" ); > if(rset != null){ > while( rset.next() ) { > > .. do something with the result > > } > } > } catch (Exception ex) { > ex.printStackTrace(); > } finally { > try { > if (rset!= null && rset.getStatement() != null && > rset.getStatement().getConnection() != null) { // Close resultset & statements > rset.getStatement().getConnection().close(); > } > } catch (Exception ignored) { } > } > return data; > } > >// ----------------------------------------------------------------- > public ResultSet executeStatement( List parameter ) { > ResultSet rset = null; > CallableStatement cstmt = null; > try { > > Connection connection = dataSource.getConnection(); > String dbBuffer = new StringBuffer( parameter.get(0).toString() ); > > if (connection != null) { > cstmt = connection.prepareCall( dbBuffer ); > rset = cstmt.executeQuery(); > } > } catch (SQLException ex) { > ex.printStackTrace(); > } > return rset; > } > > > > > >Mit freundlichen Grüßen > >Mirko Wolf > >----------------------------------------------------------------------------------------------------------------------------------------- >panta rhei systems gmbh >budapester straße 31 >10787 berlin >tel +49.30.26 01-14 17 >fax +49.30.26 01-414 13 >[EMAIL PROTECTED] >www.panta-rhei.de > >Diese Nachricht ist vertraulich und ausschliesslich für den Adressaten bestimmt. >Jeder Gebrauch durch Dritte ist verboten. Falls Sie die Daten irrtuemlich erhalten >haben, nehmen Sie bitte Kontakt mit dem Absender auf und loeschen Sie die Daten auf >jedem Computer und Datentraeger. Der Absender ist nicht verantwortlich für die >ordnungsgemaesse, vollstaendige oder verzoegerungsfreie Übertragung dieser Nachricht. > >This message is confidential and intended solely for the use by the addressee. Any >use of this message by a third party is prohibited. If you received this message in >error, please contact the sender and delete the data from any computer and data >carrier. The sender is neither liable for the proper and complete transmission of the >information in the message nor for any delay in its receipt. > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]