users@glassfish.java.net

Re: COnnection Pool Datasource from Glassfish

From: <glassfish_at_javadesktop.org>
Date: Fri, 07 Mar 2008 07:17:22 PST

http://forums.java.net/jive/thread.jspa?messageID=213369

will explain about the various types of datasources.
CPDS, XADS are for containers that pool the connections, support XA transactions respectively.

You need not cast the looked up datasource to ConnectionPoolDataSource. Internally GlassFish does it and provides it as a wrapped DataSource.
Applications, just need to call getConnection() and GlassFish internally will do the steps 3, 4 of your code snippet.
[Message sent by forum member 'jr158900' (jr158900)]

http://forums.java.net/jive/thread.jspa?messageID=262904