Two hosts in jdbc url

Deadly 提交于 2019-12-06 09:08:28
mujib ishola

This is really about failover/clustering.

jdbc:mysql://192.168.29.20:3306,192.168.29.20:6306/mysql should do it. see http://lists.mysql.com/cluster/249

Reference:

an example for Oracle (failover with 3 hosts):

jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.200.40.5)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=10.200.40.6)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=10.200.40.7)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=OLTP.WORLD)))

Regards.

Shreyash

2 options here:

1) You can write some code which would change your hibernate properties and switch your DB url.

2) you can have multiple hibernate configurations for multiple session-factories.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!