jdbc url中的两个主机 [英] Two hosts in jdbc url
问题描述
我们正在使用jdbc url,如 jdbc:mysql:// localhost:3306 / mysql
。我怎么能在这个网址中设置第二个mysql主机?如果这是不可能的,我怎么能在我的java应用程序(hibernate)连接到第二个MySQL服务器?
谢谢!
We are using jdbc url like jdbc:mysql://localhost:3306/mysql
. How could I set second mysql host in this url? If this is imposible, how could I set in my java application (hibernate) connection to second MySQL server?
Thanks!
PS。实际上我们想要将操作并行化到两个不同的数据库。在Hibernate中是否有任何解决方案?
PS. actually we want to parallelize operations to two different databases. Is there any solution for that in Hibernate?
推荐答案
这实际上是关于故障转移/群集。
This is really about failover/clustering.
jdbc:mysql://192.168.29.20:3306,192.168.29.20:6306 / mysql应该这样做。
请参阅 http://lists.mysql.com/cluster/249
jdbc:mysql://192.168.29.20:3306,192.168.29.20:6306/mysql should do it. see http://lists.mysql.com/cluster/249
参考:
- https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html
这篇关于jdbc url中的两个主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!