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.
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.
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.
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.
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.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With