Database Fail Over in Jboss Data sources

前端 未结 2 1076
忘掉有多难
忘掉有多难 2020-12-16 05:24

In JBoss data source how can I give multiple connection strings for database fail over in which I want .

There will be two Mysql db with same tables say DB1 and DB2.

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-16 05:54

    Follow this documentation. Jboss has configuration setting. https://community.jboss.org/wiki/JBossJCADatabaseFailover

    Additionally, if you are NOT using JNDI and plain JDBC call I hav another solution - Say you are making a jdbc call then you will need to get a DB connection, if the DB is down then you will get Database connection exception, in the try catch block, if you encounter connection exception, create a connection in catch block itself for the second database :-)

提交回复
热议问题