• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dao - connection pool

 
aakash bhatt
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the connection code is written in DAO. How will the app server do the connection pooling
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sean Sullivan
Ranch Hand
Posts: 427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
http://daoexamples.sourceforge.net/
Article:
http://www-106.ibm.com/developerworks/java/library/j-dao/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic