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 ? thanks.
Joined: Jul 31, 2001
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 J2EEJavadoc. 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 ]