I am having equal problem with c3p0 0.8.5.1, jTDS 1.0.2, Hibernate 2.1.8 and SQL Server. Apparently the new c3p0 not only returns but also closes cached PreparedStatemens together with the underlying one - here the jTDS PrepareStatement. When th same query is executed again, the closed statement is taken from the cache, which issues an exception:
java.sql.SQLException: Invalid state, the PreparedStatement object is closed.
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.checkOpen(JtdsPreparedStatement.java:185)
at net.sourceforge.jtds.jdbc.JtdsStatement.setFetchSize(JtdsStatement.java:773)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setFetchSize(NewProxyPreparedStatement.java:1448)
at net.sf.hibernate.impl.BatcherImpl.setStatementFetchSize(BatcherImpl.java:287)
....
Please note, with the previous Version c3p0 0.8.4.5 this does not happen.
With best Regards
Peter
PS: Here is my configuration "c0p3.properties" (the same is set to hibernate.properties too):
# Sample ResourceBundle properties file
c3p0.acquireRetryAttempts=30
c3p0.acquireRetryDelay=1000
#c3p0.autoCommitOnClose=false
c3p0.automaticTestTable=c3p0TestTable
c3p0.breakAfterAcquireFailure=false
c3p0.idleConnectionTestPeriod=120
c3p0.maxStatements=0
c3p0.maxStatementsPerConnection=5000
c3p0.numHelperThreads=15
c3p0.testConnectionOnCheckin=false
c3p0.testConnectionOnCheckout=false
|