AdrianSmith wrote:
You can't configure the "testConnectionOnCheckout" using the hibernate-cfg.xml, unfortunately. You have to create the "c3p0.properties" file and put it in the root of the classpath. This wasn't too convenient for me, but it's what worked...
hello,
I followed your solution and added c3p0 properties file ... and with server starts
I can see that the configration in ok in logs :
Quote:
[5/6/11 08:08:35:728 BST] [INFO] - Initializing c3p0-0.9.1.1 [built 15-March-2007 01:32:31; debug? true; trace: 10]
[5/6/11 08:08:36:389 BST] [INFO] - Hibernate Annotations 3.4.0.GA
[5/6/11 08:08:38:378 BST] [INFO] - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> ugpgr88f1if5iimju67k5|5b891, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> ugpgr88f1if5iimju67k5|5b891, idleConnectionTestPeriod -> 300, initialPoolSize -> 5, jdbcUrl -> jdbc:mysql://localhost:3306/amsac_emr, lastAcquisitionFailureDefaultUser -> null, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 3600, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 30, maxStatements -> 50, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> select 1;, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> true, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
but as the conection goes stale it donot validates or removes from pool... I am stucked ...