users@glassfish.java.net

Re: Access to a connection wrapped by ConnectionHolder

From: <glassfish_at_javadesktop.org>
Date: Mon, 28 May 2007 19:58:17 PDT

You can type-cast the datasource that you lookup, to,
com.sun.appserv.jdbc.DataSource (available in appserv-ext.jar). This can provide the underlying physical connection.

http://docs.sun.com/app/docs/doc/819-3659/6n5s6m5bo?a=view#beamt

eg:
InitialContext ctx = new InitialContext();
com.sun.appserv.jdbc.DataSource ds = (com.sun.appserv.jdbc.DataSource)
   ctx.lookup("jdbc/MyBase");
Connection con = ds.getConnection();
Connection drivercon = ds.getConnection(con);
// Do db operations.
//do not close physical connection (drivercon)
con.close(); // will return the connection to pool

Thanks,
-Jagadish
[Message sent by forum member 'jr158900' (jr158900)]

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