How can I stop the re-database connection? using c3po

How can I stop the connection to retry the database? using c3po ie in my application I want to stop reconnecting when I get a database connection

+4
source share
2 answers

C3P0 Documentation

  • Configure c3p0.properties in the root of the classpath
  • acquireRetryAttempts = 1
+7
source

According to MJB, setting the c3p0 configuration parameter to get RetryAttempts to 1 will cause clients to simply throw an exception when the connection fails, rather than wait and retry.

If you want the c3p0 connection pool to never try to connect to the database after a round of failure crashes (with the "round" determined by the RetryAttempts retrieval method), set breakAfterAcquireFailure to true. (By default, this is false, c3p0 will try to connect to Connections again when new clients appear.)

http://www.mchange.com/projects/c3p0/#acquireRetryAttempts

http://www.mchange.com/projects/c3p0/#breakAfterAcquireFailure

+1
source

All Articles