This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes question about DBCP example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "question about DBCP example" Watch "question about DBCP example" New topic
Author

question about DBCP example

John Robert
Ranch Hand

Joined: Jun 17, 2008
Posts: 39
Ranchers,

I am a little new to DBCP and trying to figure my way out. I was looking at the the following example code at DBCP Overview

In code, that might look like this:





I had trouble comprehending why the connectionFactory and poolableConnectionFactory (which uses the connectionFactory) initialized if its never used? Am I missing something here.
If all the datasource requires is connectionPool why cant we just create connectionPool and give it to the dataSource something like this


Am I missing something here?


And also is this implementation of the dataSource thread safe? can I have multiple threads call datasource.getConnection();


Any response would be appreciated

Thanks,



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question about DBCP example