This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
Similar Threads
DAO Pattern and Connection Pooling
How to handle transaction in DAO
connection pool in jboos
data from DB to DAO to jsp
Synchronization Problem whil accessing JDBC Code