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:
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.)
subject: HowTo configure the C3P0 properties in hibernateconfig.xml