I'm using Spring JPA for connecting to the data source. My requirement is to have multiple connection pools to the same data source so that I can manage the DB operations based on priority
Is there a way to have multiple connection pools with the same data source?
I was going through this example and I want to do almost the same thing but with the same datasource using Spring JPA
Yes, you can create even the same DataSource
just with different pool name.
For example method the will create DataSource
with different pool name:
private javax.sql.DataSource dataSource(String poolName) {
final HikariDataSource dataSource = new HikariDataSource();
//...setup DataSource properties
dataSource.setPoolName(poolName);
}