Hi, DBCP will NOT gracefully recover by itself. You need to configure it according to your desired behavior. Specifically, check out the testOnBorrow, testOnReturn, and testWhileIdle properties at http://jakarta.apache.org/commons/dbcp/configuration.html.
Yoav Shapira http://www.yoavshapira.com >-----Original Message----- >From: Ruth, Brice [mailto:[EMAIL PROTECTED] >Sent: Monday, December 06, 2004 11:32 AM >To: Tomcat Users List >Subject: DBCP/JNDI/Realms > >Good morning! > >I've been running into an intermittent problem with my database >connections for authentication. It appears that periodically, the >iSeries (DB2/400) that I connect to terminates all incoming ODBC/JDBC >connections (one a week, apparently). What happens in my application is >that users can no longer login after the connections have been dropped. >The connection pool apparently doesn't try to re-initiate the >connections after they've been dropped. > >I see an exception in my logs regarding the connection being reset, then >I see an exception relating to the pool being exhausted. I'm not >entirely sure what the root cause of the problem here is - in theory, >DBCP should recover gracefully when a connection is reset/dropped, right? > >Here's the initial exception: >java.sql.SQLException: Communication link failure.(Connection was >dropped unexpectedly.) > at com.ibm.as400.access.JDError.throwSQLException(JDError.java:365) > at >com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.java( Comp >iled >Code)) > at >com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.java( Inli >ned >Compiled Code)) > at >com.ibm.as400.access.AS400JDBCStatement.syncRPB(AS400JDBCStatement.java (Com >piled >Code)) > at >com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatemen t.ja >va(Compiled >Code)) > at >com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPrepare dSta >tement.java(Compiled >Code)) > at >com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConn ecti >on.java(Compiled >Code)) > at >com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConn ecti >on.java(Compiled >Code)) > at >org.apache.commons.dbcp.DelegatingConnection.prepareStatement(Delegatin gCon >nection.java(Compiled >Code)) > at >org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.pr epar >eStatement(PoolingDataSource.java(Compiled >Code)) > at >org.apache.catalina.realm.DataSourceRealm.credentials(DataSourceRealm.j ava: >460) >[snip] > >Here's the next one: >2004-12-06 04:39:21 DataSourceRealm[]: Exception performing authentication >org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, >pool exhausted > at >org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSour ce.j >ava(Compiled >Code)) > at >org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.j ava( >Compiled >Code)) > at >org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:438 ) > at >org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm. java >:277) >[snip] > >So, what I've done now to see if it helps matters any, is specify the >AS400's own connection pool factory in my JNDI definition, like so: > > <parameter> > <name>factory></name> > ><value>com.ibm.as400.access.AS400JDBCConnectionPoolDataSource</value> > </parameter> > >Both Tomcat's form authentication as well as my application (through >iBATiS) use this JNDI DataSource for connections. > >Can anyone shed more light on what the root cause of the problem is >here? Should DBCP gracefully recover? > >Regards, >Brice Ruth > >-- >Brice Ruth, Sr. IT Analyst >Fiskars Brands Inc >http://www.fiskarsbrands.com/ > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
