Ozgur Sahoglu wrote: > > Hi, > > What is the difference between javax.sql.DataSource and > javax.sql.ConnectionPoolDataSource interfaces?
A DataSource is meant to be used by an application. It could be written by the jdbc driver as a way to provide physical db connections. It is also the interface that would be used by an application using a connection pool to get (most likely) logical connections. A ConnectionPoolDataSource (CPDS) is generally written by the jdbc driver author to provide physical connections that are meant to be pooled. So a CPDS is never used by an generic application. A connection pool would usually use the CPDS internally as the source to grab new physical connections. Jdbc2pool expects to be given a jndi name so that it can lookup the source of physical connections. It provides an adapter CPDS that wraps the older Driver style of specifying the source of physical connections as is implemented by mysql and other jdbc 1.x jdbc drivers. > In API docs it is written > that connection pool implementation of the DataSource works with a > middle-tier connection pooling manager. I am using mm.mysql, and I am > wondering if connection pool is implemented with this MySQL driver. As far > as I see from previous postings everyone seems to use a third party > connection pooling manager such as tyrex, poolman, protomatter, etc. > > Similarly, what is the difference between a java.sql.Connection and > javax.sql.PooledConnection interfaces in this context? > You would use a Connection object in your application. A connection pool should pool PooledConnections which are then used to generate Connections as an application request them. BasicDataSource, and DBCP in general, pools Connection objects. This was the standard object that was pooled prior to jdbc2 so the difference between a physical and logical connection was blurred. It really makes little difference to an application using the pool. So in summary. Unless you are writing a connection pool, you should ignore the existence of a PooledConnection. You might need to know the properties of the CPDS provided by your jdbc vendor in order to deploy it via jndi, but it would not be used directly by your application. john mcnally -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>
