I am trying to use the c3p0 settings , to enable the application to auto discard a stale connection, and reestablish the connection automatically.I have set the configuration properties as below in the sessionfactoryprovider class :
configuration.setProperty("hibernate.c3p0.min_size", c3p0
.get("minPoolSize") != null ? c3p0.get("minPoolSize")
: "1");
configuration.setProperty("hibernate.c3p0.max_size", c3p0
.get("maxPoolSize") != null ? c3p0.get("maxPoolSize")
: "50");
configuration.setProperty("hibernate.c3p0.timeout", c3p0
.get("maxIdleTime") != null ? c3p0.get("maxIdleTime")
: "900");
configuration.setProperty(
"hibernate.c3p0.acquireRetryAttempts",
c3p0.get("acquireRetryAttempts") != null ? c3p0
.get("acquireRetryAttempts") : "30");
configuration.setProperty(
"hibernate.c3p0.acquireIncrement",
c3p0.get("acquireIncrement") != null ? c3p0
.get("acquireIncrement") : "5");
configuration.setProperty(
"hibernate.c3p0.idleConnectionTestPeriod",
c3p0.get("idleConnectionTestPeriod") != null ? c3p0
.get("idleConnectionTestPeriod") : "60");
configuration.setProperty("hibernate.c3p0.initialPoolSize", c3p0
.get("minPoolSize") != null ? c3p0.get("minPoolSize")
: "1");
configuration.setProperty(
"hibernate.c3p0.maxStatements",
c3p0.get("maxStatementsPerConnection") != null ? c3p0
.get("maxStatementsPerConnection")
: "0");
configuration.setProperty("preferredTestQuery", "select 1 from dual");
configuration.setProperty("hibernate.c3p0.testConnectionOnCheckin",
"true");
configuration.setProperty("hibernate.c3p0.testConnectionOnCheckout",
"true");
configuration.setProperty("testConnectionOnCheckin", "true");
configuration.setProperty("hibernate.c3p0.preferredTestQuery",
"select 1 from dual");
I don’t find any logs in the application , trying to execute the test query, nor is it recovering after a db restart. “show_sql” s set to true in the properties file, and in the logs, I can see the other queries executing.
The package versions are as follows :
C3P0 = 0.9.1.2;
HibernateAnnotations = 3.3;
Hibernate = 3.3;
Could someone please suggest how I should go about debugging this ?
Try setting the logging level for c3p0 to debug in your log4j-configuration: