sebastien
Mar 9th, 2006, 02:38 AM
I'm working on a Spring-based application whose purpose is to analyze differences between remote databases configured by the user. The information necessary to connect to those databases is stored in the application's database via Hibernate.
Until now, I've been using basic JDBC DriverManager to connect to remote databases but as I'm needing a DataSource now instead of a connection, I'd like to try to use connection pooling to make things cleaner. The thing is I don't know Commons DBCP very well (it seems to be a good choice for connection pooling) and I'd like to know if that kind of use-case is possible:
1- When the application starts up, it initializes some sort of DataSourceFactory which I can inject in my service beans.
2 - When the user configures a new remote database to analyze, a pooled dataSource is created for that database
3- When the analysis runs, it gets its dataSource from the DataSourceFactory.
How could I do something like that.
Until now, I've been using basic JDBC DriverManager to connect to remote databases but as I'm needing a DataSource now instead of a connection, I'd like to try to use connection pooling to make things cleaner. The thing is I don't know Commons DBCP very well (it seems to be a good choice for connection pooling) and I'd like to know if that kind of use-case is possible:
1- When the application starts up, it initializes some sort of DataSourceFactory which I can inject in my service beans.
2 - When the user configures a new remote database to analyze, a pooled dataSource is created for that database
3- When the analysis runs, it gets its dataSource from the DataSourceFactory.
How could I do something like that.