aspose file tools*
The moose likes JDBC and the fly likes JDBC Connection Pooling Framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC Connection Pooling Framework" Watch "JDBC Connection Pooling Framework" New topic
Author

JDBC Connection Pooling Framework

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

Guys,

I would like to know which framework is the ideal one for doing a JDBC connection pooling. I would like to have a standalone application and need a connection pooling mechanism for my JDBC database calls.


SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

A standalone application which gets installed on each user PC ??
If that will be the case, then IMO, you don't need any DBCP. Still if you need one, I'll prefer Apache Commons DBCP


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

I found this to be good enough....http://www.source-code.biz/snippets/java/8.htm
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

I tried using the DBCP BasicDataSourceExample....as below:






Where did 7 come from?? I was the only one who ran this program. I created a connection pool size of 10...
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

I mean in the above example, where is the Connection object getting pooled?
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

What is the difference between the above sample and the one here in this link...http://commons.apache.org/dbcp/apidocs/org/apache/commons/dbcp/datasources/package-summary.html (Without JNDI.....given at the bottom of the page)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Jothi Shankar Kumar wrote:I mean in the above example, where is the Connection object getting pooled?

If you want pooling, why are you using a BasicDataSource instead of a PoolingDataSource?


Ping & DNS - updated with new look and Ping home screen widget
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

Yes, what are the differences between the two?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
After having read their respective javadocs, what do *you* think the differences are?
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

What can I infer from just there two lines of Javadoc...

Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is not the only way to combine the commons-dbcp and commons-pool packages, but provides a "one stop shopping" solution for basic requirements.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

Do you mean to say, I have to try something like this?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
I'd start by looking through the example code that's available on the DBCP web site. The README file that goes along with those examples specifically mentions reading the package javadocs of org.apache.commons.dbcp to get an overview of how it all works.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

Normally, it is the Connection object that we pool? am I right? But the examples shown in the DBCP actually pools the DataSource.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JDBC Connection Pooling Framework
 
Similar Threads
issue with datasource
Connection pooling...?
Looking for a Application Transaction Framework
2.0 connection pooling and other methodologies
connection pooling