Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jboss 7 - Auto Switch back from Secondary Database to Primary Database

I currently have a configuration in my Data-source tags of Standalone.xml of jboss 7 to connect to a Secondary Database on Fail over from Primary Database.This is happening Fine.

Can i make my jboss 7 to check for primary DB connection every now and then so that if the Failed Primary Database has come up now, inform jboss to connect back to primary Database?

like image 831
Vasanth Nag K V Avatar asked May 08 '15 16:05

Vasanth Nag K V


1 Answers

you need to add this piece of xml in your datasource

<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
<validate-on-match>true</validate-on-match>
</validation>
like image 162
marcobazzani Avatar answered Oct 21 '22 09:10

marcobazzani