Reputation: 119
Is it possible to switch DB dynamically in JBoss(Either loading XML or switching to another DataSource)? If so then how?
Upvotes: 0
Views: 1025
Reputation: 344
You can, by touching the -DS.xml file in your deploy directory, the scanner will re-deploy the Data source descriptor. I wonder whey you would want to do this though? If you are 'swtiching' between two databases, why don't you just deploy the descriptors for the two databases?? either in one -DS.xml file, or as two seperate -DS.xml files ? Or, are you saying you are using a JPA persistence called 'XXX' which refers to two different DB's.
Upvotes: 1
Reputation: 7316
The JBoss deploy directory contains the hot-deployable services (those which can be added to or removed from the running server). It also contains applications for the current server configuration. You deploy your application code by placing application packages (JAR, WAR and EAR files) in the deploy directory. The directory is constantly scanned for updates, and any modified components will be re-deployed automatically.
So at runtime if you change the Datasource file.It will be re-deployed automatically.And you will get the changed effect without restarting the server.
Upvotes: 1