DB connection pooling using Apache DBCP
843859Jun 4 2008 — edited Nov 20 2014Hi,
I am trying to implement Apache commons DBCP into my struts application.
This is the layering that I am having currently:
Authenticate.java - > ConnectionManager.java -> ConfigurationManager.java
ConfigurationManager -> reads the JDBC URL etc from a config file or xml file
ConnectionManager -> takes the configuration information from the ConfigurationManager and establishes the connections and keeps them ready in the pool
Authenticate -> Calls ConnectionManager for using a connection and closes it to return to the pool.
I am trying to use a DriverManager.getconnection and not from a DataSource. Where do i mark the class as singleton and where do I set the maximum pool size?
Can someone help by giving an example of the same?
I tried seeing http://www.freshblurbs.com/jakarta-commons-dbcp-tutorial. Does this sound like the right approach?
Thanks in advance