本文介绍了c3p0 Java数据库池,故障转移配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当数据库关闭时,ip和端口会自动切换到另一个数据库服务器。
When a database is down then automatically the ip and port switch to another db server.
我应该如何配置Web应用程序的c3p0连接池以遵循此数据库故障转移机制?
How should I configure c3p0 connection pooling of my web apps to follow this Database failover mechanism?
当前,我正在使用c3p0,但是在上一次数据库故障转移中,池连接未能重新建立。
Currently, I am using c3p0, however in the last db failover, pool connections failed to reestablished.
推荐答案
请求失败后重新建立。
有助于尽快出现的属性
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
p:testConnectionOnCheckin="true"
p:preferredTestQuery="SELECT @@VERSION"
p:acquireRetryAttempts="10"
这篇关于c3p0 Java数据库池,故障转移配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!