I want to initialize several connection pools when starting the context by reading connection parameters from the database table. Basically I want to consider the following two things.
Read the connection properties from the database, not the properties file.
They represent several connection pools (strings in db).
So my question is: how can I iterate over the list of rows returned by the database in a spring context file and create several data source objects and store them (say, on a map) using a unique key?
The structure of the Databse table is as follows:
+ -------------- + ---------------- + --------------- +
| DBSERVERNAME | DBDRIVERCLASS | DBMINPOOLSIZE |
+ -------------- + ---------------- + --------------- +
| Server1 | Mysql-Driver | 10 |
| Server2 | Oracle-Driver | 20 |
| Server3 | DB2-Driver | 10 |
+ -------------- + ---------------- + --------------- +
Let me know if additional data is needed. Thank.
source
share