Riaz Bell
Riaz Bell

Reputation: 258

How can i stop database retry connection? using c3po

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

Answers (2)

Steve Waldman
Steve Waldman

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

MJB
MJB

Reputation: 9399

C3P0 documentation

  1. Set up c3p0.properties in root of classpath
  2. acquireRetryAttempts=1

Upvotes: 8

Related Questions