Reputation: 258
How can i stop database retry connection?using c3po i.e in my application i want to stop retry connection when i get database communication is fail
Upvotes: 6
Views: 5821
Reputation: 14083
As MJB says, setting c3p0's config parameter acquireRetryAttempts to 1 will cause clients to merely experience an Exception on a Connection acquisition failure rather than waiting and retrying.
If you wish for a c3p0 Connection pool to nevermore attempt to Connect to the database after a round of acquisition failures (with a "round" being defined by acquireRetryAttempts), set the config parameter breakAfterAcquireFailure to true. (By default this is false, c3p0 will try again to acquire Connections when new clients come calling.)
http://www.mchange.com/projects/c3p0/#acquireRetryAttempts
http://www.mchange.com/projects/c3p0/#breakAfterAcquireFailure
Upvotes: 3