Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DB connection pooling using Apache DBCP

843859Jun 4 2008 — edited Nov 20 2014
Hi,

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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 3 2008
Added on Jun 4 2008
2 comments
429 views