Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two hosts in jdbc url

We are using jdbc url like jdbc:mysql://localhost:3306/mysql. How could I set second mysql host in this url? If this is imposible, how could I set in my java application (hibernate) connection to second MySQL server? Thanks!

PS. actually we want to parallelize operations to two different databases. Is there any solution for that in Hibernate?

like image 526
Dedyshka Avatar asked Dec 01 '22 20:12

Dedyshka


1 Answers

an example for Oracle (failover with 3 hosts):

jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.200.40.5)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=10.200.40.6)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=10.200.40.7)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=OLTP.WORLD)))

Regards.

like image 194
Stéphane Millien Avatar answered Dec 03 '22 10:12

Stéphane Millien