Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes EJB and other Java EE Technologies and the fly likes Dao - connection pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Dao - connection pool" Watch "Dao - connection pool" New topic

Dao - connection pool

aakash bhatt
Ranch Hand

Joined: Jan 09, 2003
Posts: 182
If the connection code is written in DAO. How will the app server do the connection pooling
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
It depends on how the DAO is implemented. The pattern itself doesn't mandate any particular approach to getting JDBC connections -- or even using one in the first place.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Sean Sullivan
Ranch Hand

Joined: Sep 09, 2001
Posts: 427
If you want to take advantage of the connection pooling provided by the application server, you will need to:

1) lookup the javax.sql.DataSource object via JNDI
2) invoke DataSource.getConnection()
Example code:
I agree. Here's the link:
subject: Dao - connection pool