Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about DBCP example

 
John Robert
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic