Ganesh
Ganesh

Reputation: 169

Mysql connection pool with fail over

Question 1: I am using MySQL Connector /J to connect to MySQL. I am creating connection for every request. I need to use connection pool. Whether i need to choose c3p0 or i could use MysqlConnectionPool class provided by the connector library.

Question 2: I may need to load balace / failover between two MySQL database servers. I could use jdbc:mysql://host,host2/dbname to do the failover automatically. I want to use connection pool and failover in combination. How should i acheive it.

Upvotes: 1

Views: 1115

Answers (1)

duffymo
duffymo

Reputation: 308753

I'd recommend using C3PO or something else. It'll integrate into a Java EE app server better, and it's database agnostic.

Your second question is a good deal more complicated. Load balancing is usually done with an appliance of some kind, like an F5 or ACE, that stands between the client and the load balanced instances. Is that how you're doing it? How do you plan to keep the data in synch if you load balance between the two? If the connections aren't "sticky", you'll expect to find INSERTed data in both instances.

Maybe this reference can help you get started:

http://www.howtoforge.com/loadbalanced_mysql_cluster_debian

Upvotes: 2

Related Questions