Persistence.xml
<properties>
<property name='javax.persistence.jdbc.driver' value='org.postgresql.Driver' />
<property name='javax.persistence.jdbc.url'
value='jdbc:postgresql://192.168.19.66:5432/service1' />
<property name='javax.persistence.jdbc.user' value='postgres' />
<property name='javax.persistence.jdbc.password' value='root' />
<property name='hibernate.dialect' value='org.hibernate.dialect.PostgreSQLDialect' />
<property name='hibernate.connection.shutdown' value='true' />
<property name='hibernate.hbm2ddl.auto' value='none' />
<property name='hibernate.show_sql' value='false' />
<property name='hibernate.format_sql' value='false' />
<!-- Connection Pooling -->
<property name="hibernate.connection.provider_class"
value="org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider" />
<property name="hibernate.c3p0.max_size" value="100" />
<property name="hibernate.c3p0.min_size" value="5" />
<property name="hibernate.c3p0.acquire_increment" value="5" />
<property name="hibernate.c3p0.idle_test_period" value="500" />
<property name="hibernate.c3p0.max_statements" value="50" />
<property name="hibernate.c3p0.timeout" value="10000" />
</properties>
Exception
[C3P0PooledConnectionPoolManager[identityToken->1hge4qw8wh4gndjoawud4|b81be4]-AdminTaskTimer] DEBUG com.mchange.v2.async.ThreadPoolAsynchronousRunner - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@5d1aef -- Running DeadlockDetector[Exiting. No pending tasks.]
[C3P0PooledConnectionPoolManager[identityToken->1hge4qw8wh4gndjoawud4|b81be4]-AdminTaskTimer] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - Continuing acquisition series. pending_acquires [5], attempts_remaining: 20
[C3P0PooledConnectionPoolManager[identityToken->1hge4qw8wh4gndjoawud4|b81be4]-AdminTaskTimer] DEBUG com.mchange.v2.async.ThreadPoolAsynchronousRunner - com.mchange.v2.async.ThreadPoolAsynchronousRunner@b66600: Adding task to queue -- com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@934847
[C3P0PooledConnectionPoolManager[identityToken->1hge4qw8wh4gndjoawud4|b81be4]-HelperThread-#0] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - An exception occurred while acquiring a poolable resource. Will retry.
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:264)
at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:240)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:146)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:195)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:184)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:200)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1086)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1073)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:44)
at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:648)
Getting exception java.sql.SQLException: No suitable driver.
As i look inside the source code, it is looking for the property "hibernate.connection.driver_class". Already, i mentioned the driver class in "javax.persistence.jdbc.driver".
I think i am not doing right way to configure the connection pool. The application is using hibernate 4.1.11(without spring), JPA2, Postgresql 9.1. There is no hibernate.cfg.xml.
QUESTION
- What is the way for configuring connection pool in Hibernate/JPA application.
- Already i provided in javax.persistence.jdbc.driver? whether the connection created by connection pool and JPA connection will be the same or different if i provide the
hibernate.connection.driver_class
property?
NOTE
- Postgresql driver is in classpath.
- If i remove lines after
<!-- Connection Pooling -->
, It runs. But if i add lines after<!-- Connection Pooling -->
for connection pooling, I am getting this exception.