Hi,
javax.sql.DataSource/ConnectionPoolDataSource/XADataSource are defined by JDBC Specification.
Typically, javax.sql.DataSource can be used by any application directly to talk to database.
User can just do, DataSource.getConnection(), issue queries and close the connection.
ConnectionPool/XADataSource are meant to be used in "managed" environment. eg: ApplicationServer or any container that supports connection-pooling. [XA has more requirements other than con.pooling]
Behind the scenes, container will do, conpoolDataSource.getPooledConnection() (which will be pooled) and only a handle of this pooled connection is returned to user. (pooledConnection.getConnection())
when the handle is closed, physical (pooled ) connection is not closed, it will be ready to be reused.
[b]In GlassFish, connections of all these three types of datasources are transparently pooled. [/b]
So, the decision that one has to make is whether to use DataSource/ConPoolDataSource or XADataSource.
XA is meant for distributed transactions [eg : a transaction involving multiple databases]
You can read Chapter 9, 11 of JDBC 3.0 Specification
Thanks,
-Jagadish
[Message sent by forum member 'jr158900' (jr158900)]
http://forums.java.net/jive/thread.jspa?messageID=213369