Reputation: 23
Earlier I was using c3p0:c3p0 and now I have migrated to com.mchange:c3p0.
And also moved all the configuration FROM
<bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
p:driverClass="${db.driver}"
p:jdbcUrl="${dst.db.url}${db.host}:${db.port}/${db.name}"
p:user="${db.user}" p:password="${db.pw}"
p:initialPoolSize="2" p:minPoolSize="2" p:maxPoolSize="30"
p:idleConnectionTestPeriod="300" p:acquireIncrement="1"
p:maxStatements="300" p:maxIdleTime="45">
TO
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${db.driver}" />
<property name="jdbcUrl" value="${db.url}" />
<property name="user" value="${db.user}" />
<property name="password" value="${db.pw}" />
<property name="initialPoolSize" value="2" />
<property name="minPoolSize" value="2" />
<property name="maxPoolSize" value="30" />
<property name="idleConnectionTestPeriod" value="300" />
<property name="acquireIncrement" value="1" />
<property name="maxStatements" value="300" />
<property name="maxIdleTime" value="45" />
</bean>
dependencies =>> com.microsoft.sqlserver::mssql-jdbc and com.mchange::c3p0 driver - com.microsoft.sqlserver.jdbc.SQLServerDriver
After this migration I'm started getting errors when I start to make the calls to application database on tomcat 10.1.x and spring 6.2.0 and jdk 21
Exception is: PreparedStatementCallback; uncategorized SQLException for SQL [SQL STATMENT]
------
Problem with checked-in Statement, discarding.
com.microsoft.sqlserver.jdbc.SQLServerException: The statement is closed.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:242)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.checkClosed(SQLServerStatement.java:1131)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.clearParameters(SQLServerPreparedStatement.java:405)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache.refreshStatement(GooGooStatementCache.java:605)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache.checkinStatement(GooGooStatementCache.java:237)
-----
SQL state [null]; error code [0]; The statement is closed.
at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1557)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:677)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1003)
at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.update(NamedParameterJdbcTemplate.java:365)
Upvotes: 0
Views: 39