You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Rodney Waldhoff <rw...@apache.org> on 2003/03/03 16:38:33 UTC

RE: [DBCP] Exceptions in multi user environment.

If we take this message ("Closed Statement") at face value, then one of
three things has happened:

1) The database has closed a connection/statement out from under DBCP and
the client code.

2) DBCP has closed a connection/statement.

3) The client code has closed (really closed, not just returned to the
pool), a connection/statement.

I don't see how #3 is possible unless the client code is unwrapping the
Connection/Statement returne by DBCP.

#2 is meant to happen in some circumstances, but only in circumstances
that should prevent the end user from obtaining that connection/statement
again.  Some circumstances that may cause the pool to close a connection
the client is using include (a) returning the same connection to the pool
more than once (making the pool think they are two different connections,
(b) hanging on to a connection after having returned it to the pool.  It's
possible that something related to "abandonded object" tracking could
cause this also, but frankly I don't know anything about that.  It's also
possible that some bug in pool/dbcp could lead to this as well, of course.

#3 might happen if the database was bounced, or if it drops a
connection/statement due to inactivity or longevity.  Configuring a "test
while idle"/"keep alive" query should generally prevent that, as would
"test on borrow", at some expense.

On Fri, 28 Feb 2003, Linda Steckel wrote:

> I get the same error but I've checked exhaustively and cannot find either of
> these cases.  Plus, this error occurs on the same code running numerous
> times - sometimes in 10 minutes, sometimes in a day, sometimes in 2 days.
>
> -----Original Message-----
> From: Rodney Waldhoff [mailto:rwaldhoff@apache.org]
> Sent: Friday, February 28, 2003 5:43 AM
> To: Jakarta Commons Users List
> Subject: Re: [DBCP] Exceptions in multi user environment.
>
>
> Is it possible that you're either returning a connection to the pool more
> than once, or holding on to a connection after having returned it to the
> pool?
>
> On Thu, 27 Feb 2003 Gaurav.Goyal@ercgroup.com wrote:
>
> > Hi,
> > 	I'm new to DBCP. Recently we have used DBCP in one of our projects.
> > When around 5-6 users start accessing our application we start getting
> some
> > strange errors in an unpredictable manner. The trace from a few is
> included
> > below. Does any one have any suggestions to fix these?
> >
> > Thanks.
> >
> > 1)
> > , root cause: java.sql.SQLException: Closed Statement
> > 	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
> > 	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211)
> > 	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:274)
> > 	at
> >
> oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:453
> > 0)
> > 	at
> >
> oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:6
> > 66)
> > 	at
> > oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1420)
> > 	at
> >
> org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:
> > 159)
> >
> > 2)
> > , root cause: java.sql.SQLException: Connection is closed.
> > 	at
> >
> org.apache.commons.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.
> > java:245)
> > 	at
> >
> org.apache.commons.dbcp.DelegatingConnection.createStatement(DelegatingConne
> > ction.java:170)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>