aspose file tools*
The moose likes Object Relational Mapping and the fly likes HowTo configure the C3P0 properties in hibernateconfig.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "HowTo configure the C3P0 properties in hibernateconfig.xml " Watch "HowTo configure the C3P0 properties in hibernateconfig.xml " New topic
Author

HowTo configure the C3P0 properties in hibernateconfig.xml

Ekta Matani
Greenhorn

Joined: May 17, 2005
Posts: 14
Hi,
I am using hibernate with mysql as database.
After few save & update operations, i am getting the following error :

[BasicResourcePool] com.mchange.v2.resourcepool.BasicResourcePool$Ac
- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30).

how to resolve this?

the properties which i have configured in hibernateconfig.xml are set with following values:

<property name="c3p0.max_size">100</property>
<property name="c3p0.min_size">10</property>
<property name="c3p0.timeout">10</property> <!-- seconds -->
<property name="c3p0.acquireRetryAttempts">30</property>
<property name="c3p0.acquireIncrement">5</property>
<property name="c3p0.idleConnectionTestPeriod">300</property>
<property name="c3p0.initialPoolSize">20</property>
<property name="c3p0.maxPoolSize">100</property>
<property name="c3p0.maxIdleTime">300</property>
<property name="c3p0.maxStatements">50</property>
<property name="c3p0.minPoolSize">10</property>

do i need to add any other property tags?or any value changes required for properties?
Please help me.

Thank you,
Ekta
P.Sivaraj
Ranch Hand

Joined: Mar 10, 2005
Posts: 31
Hi,
What is this. Check the option to clear the connections.

Siva.
Emanuel Kadziela
Ranch Hand

Joined: Mar 24, 2005
Posts: 186
The error basically means that the system (or more precisely the c3p0 connection pool manager) was asked for another(more) connection(s) by the application, but had all currently held connections checked out (being used) and tried to acquire 5 more connections from the database. It attempted to do this 30 times unsuccessfully, and gave up returning that error message. There are several things you should look at here. First, the simplest (dirty) solution would be to lower your aqcuireIncrement setting to 1, so the pool can ask the database for one new connection at a time, instead of 5. You can also bump up the acquireRetryAttempts to give it more chances to succeed. But, you should really look into the implications of this error message (why does it need to increment the pool, why does it fail to do so, etc.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HowTo configure the C3P0 properties in hibernateconfig.xml