This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

data source and connection pooling ?  RSS feed

Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I have two questions here ---
I want to use some tool to configure database connection for some java web application.
1. what exactly does a "data source" mean ? It is not for a particular database, is it some logic name for various applications ? Can I let different web applications share a same "data source" ?
2. about connection pooling. After I specify the "data source", I am asked to specify the driver, url, and connection pooling. So, it seems this connection pooling option is ONLY for this data source. In other words, it is ONLY for the applications using this data source, is that right ? If I have some other application that access the same database but if they choose not to use connection pool, then these application do not have connection pooling feature EVEN they access the same database. Is that right ?
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. A DataSource is simply a factory that maintains a "pool" of Connection objects. Creating Connection objects is a relatively expensive operation so maintaining a pool of Connection objects and reusing them for an application's database requests is more efficient. Refer to the J2EE Javadoc.
A datasource is usually used by J2EE applications and accessed thru JNDI. You would perform a JNDI lookup to use the datasource.
Yes, you should be able to allow multiple web applications use the same datasource but that is probably not a "Best Practice". I would probably create separate datasources.
2. Yes. Those applications that do not use a datasource will be required to create their own Connection objects instead of reusing those provided by the DataSource object.
[ January 14, 2004: Message edited by: Jay Damon ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!