File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes question about DBCP example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "question about DBCP example" Watch "question about DBCP example" New topic

question about DBCP example

John Robert
Ranch Hand

Joined: Jun 17, 2008
Posts: 39

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


I agree. Here's the link:
subject: question about DBCP example
jQuery in Action, 3rd edition