JBOSS connectivity with multiple database (sql cluster)

663 Views Asked by At
  1. I want to connect JBOSS to multiple databases (with failover recovery and loadbalancing) i.e. connection switches from one DB to the other in case of failure of first DB connection.

  2. Also each DB connection has a seperate set of userID and password.

I have almost done the 1st part but still stuck in the second part.

How do I do it?

1

There are 1 best solutions below

0
On

That's not how it should be done. It should be done so that there is only one frontend instance where server (here JBoss) connects to, and it sends the actual connection to whichever db instance it sees fit.

The details on how to implement that would depend on the server used. Since you tagged the question with mysql, you might be interested in this tutorial on how to set up such a thing with that.

If you insist on doing it your way, I don't see how for example load balancing would work. How would JBoss know which server has more load? How would you know when you should activate failover?

If you have answers to those questions already, as indicated in your question, there's nothing preventing you from creating regular datasources with different userids and passwords pointing to different databases. I just think that's inherently wrong way to go with this.