Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c3p0 Java Database Pooling, failover configuration

When a database is down then automatically the ip and port switch to another db server.

How should I configure c3p0 connection pooling of my web apps to follow this Database failover mechanism?

Currently, I am using c3p0, however in the last db failover, pool connections failed to reestablished.

like image 648
fraped Avatar asked Mar 19 '15 16:03

fraped


People also ask

How does c3p0 connection pooling work?

Connection Pooling with the c3p0 Libraryc3p0 is an easy-to-use library for making traditional JDBC drivers “enterprise-ready” by augmenting them with functionality defined by the jdbc3 spec and the optional extensions to jdbc2. As of version 0.9. 5, c3p0 fully supports the jdbc4 spec.

How do I set up connection pooling?

Click Resources > JDBC > Data Sources > data_source > [Additional Properties] Connection pool properties. Click Resources > JMS->Queue connection factories-> queue_connection_factory ->[Additional Properties] Connection pool.

What is c3p0 pool?

c3p0 is a Java library that provides a convenient way for managing database connections. In short, it achieves this by creating a pool of connections. It also effectively handles the cleanup of Statements and ResultSets after use.

Which is the best connection pooling in Java?

Although there are a lot of frameworks available to choose from like C3P0, Apache DBCP, BoneCp, Vibur etc. However, the most popular choices are Tomcat JDBC & HikariCP.


1 Answers

Reestablished after a failing request. Attributes that helps to come over as soon as possible

  • p:testConnectionOnCheckin="true"
  • p:preferredTestQuery="SELECT @@VERSION"
  • p:acquireRetryAttempts="10"
like image 177
fraped Avatar answered Oct 14 '22 18:10

fraped