I'm using a spring project with org.apache.commons.dbcp.BasicDataSource datasource.
If i want my Database to support a failover where do i configure it?
I cant find any references with google
I'm using a spring project with org.apache.commons.dbcp.BasicDataSource datasource.
If i want my Database to support a failover where do i configure it?
I cant find any references with google
Copyright © 2021 Jogjafile Inc.
You were a bit generic in the question. I describe some possible solutions.
If you can use c3p0 here is an example with mysql server. In the tomcat server.xml define this:
In case of sql server replace
with
In case of oracle another solution is recomended. I just give you the link to the offical spring documentation:
http://static.springsource.org/spring-data/jdbc/docs/current/reference/html/orcl.failover.html
and I just copy here the spring bean to be used for completness.
Other approaches are possible. E.g. using the AbstractRoutingDataSource offered from springframework.