Get the native JDBC Connection object from ConnectionHolder

Hi all...

I'm currently using an Oracle feature called OracleAQ which helps me to receive JMS messages from Oracle database when an event occurs. This feature allows me to connect from a Java application through a JDBC Connection -- actually I can connect by configuring a JDBC Connection through the "thin" driver as in a standalone environment, but this is a really mess when configuring several endpoints in my application server instance -- and receive JMS messages from the OracleAQ topics.

I tried to configure a DataSource connection pool from the AS (Sun Java System AS 9), but the Oracle AQ APIs required a native (oracle.jdbc.internal.OracleConnection) and I can only get (at least it seems to) from the pool is a wrapper java.sql.Connection object called ConnectionHolder with a package visibility method "getConnection" that seems to return the native connection I can not obtain...

Please, any help or comments would be very appreciated

Regards

Jonathan

[1004 byte] By [jonren] at [2007-11-26 10:44:18]
# 1

Hi Jonathan,

Following link from 9.0 PE Developer guide

http://docs.sun.com/app/docs/doc/819-3659/6n5s6m5bl?a=view#beamt explains how to get the physical connection.

As a better programming practise and not to corrupt the pool,

DataSource ds = (com.sun.appserv.jdbc.DataSource)lookup ("datasource");

Connection con = ds.getConnection();

OracleConnection oracleConn = (oracle.jdbc.internal.OracleConnection)ds.getConnection(con);

do db operations using the oracle-connection

oracleConn = null // do not close this physical connection, just remove the reference.

con.close();

Thanks,

-Jagadish

JagadishPrasath at 2007-7-7 2:56:18 > top of Java-index,Application & Integration Servers,Application Servers...
# 2
Hi Jagadish,This code you suggested me pretty solved my problem...I have already rewarded you with 10 deserved Duke Dollars!!!Thank you very much!!!!Thread closedRegards,Jonathan.
jonren at 2007-7-7 2:56:18 > top of Java-index,Application & Integration Servers,Application Servers...