swaldman / c3p0

a mature, highly concurrent JDBC Connection pooling library, with support for caching and reuse of PreparedStatements.
http://www.mchange.com/projects/c3p0
Other
1.28k stars 338 forks source link

mchange.v2.c3p0.impl.NewPooledConnection - [c3p0] The following Exceptions occurred while trying to clean up a Connection's stranded resource #169

Open jsusanto opened 1 year ago

jsusanto commented 1 year ago

Hi Team,

I'm using c3p0 version: 0.9.5

I keep getting the following INFO exception.

======================================================================== INFO com.mchange.v2.c3p0.impl.NewPooledConnection - [c3p0] The following Exceptions occurred while trying to clean up a Connection's stranded resources:

INFO com.mchange.v2.c3p0.impl.NewPooledConnection - [c3p0 -- conection resource close Exception] java.sql.SQLException: JZ006: Caught IOException: java.io.IOException: JZ0EM: End of data. at com.sybase.jdbc4.jdbc.ErrorMessage. raiseError(Unknown Source) ~[jConnect-7.0.jar:?] at com.sybase.jdbc4.jdbc.ErrorMessage. raiseErrorCheckDead(Unknown Source) ~[jConnect-7.0.jar:?] at com.sybase.jdbc4.tds. TdsResultSet.next(Unknown Source) ~[jConnect-7.0.jar:?] at com.sybase.jdbc4.tds. TdsResultSet.close(Unknown Source) ~[jConnect-7.0.jar:?] at com.sybase.jdbc4. jdbc.SybResultSet.markDead(Unknown Source) ~[jConnect-7.0.jar:?] at com.sybase.jdbc4.jdbc.SybResultSet.close(Unknown Source) ~[jConnect-7.0.jar:?] 2 at com.sybase.jdbc4.jdbc.SybResultSet.close(Unknown Source) ~[jConnect-7.0.jar:?] at

========================================================================

Below is the current configuration.

By any chance, do you know why I keep getting this INFO exception? how to resolve this issue?

Many thanks,

swaldman commented 6 months ago

When you close (really check in) a Connection, c3p0 tries to clean up any Statements or ResultSets that clients did not close, before making the Connection available again in the pool. Ideally, there should be no such stranded resources, because clients should use try-with-resources when working with Statements and ResultSets. But that is not always the case.

In this case, a client failed to clean up a ResultSet, c3p0 tried to clean that up (ie close()) that prior to making it available from the pool, but an Exception occurred when calling that close()

The best way to avoid this kind of thing is to take care to close() your Statements and ResultSets.