does the org.apache.tomcat wrapped dbcp still expose getInnermostDelegate()
?

> Connection c = dc.getInnermostDelegate();
> log(c.getClass().getName() + ": " + c);



> -----Original Message-----
> From: Robert Upshall [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, November 09, 2005 10:34 AM
> To: Tomcat Users List
> Subject: How do I acces the Underlying Connection of a Data Source?
> 
> 
> How do I access the underlying connection of a data source?  I am 
> connecting to a DB2 database using the JTOpen drivers.  I define the 
> context in the server.xml and the jndi lookup is successful, 
> so is the 
> getconnection on the datasource.  The problem is that I need 
> access to 
> the underlying connection (AS400JDBCConnection) but I cannot get past 
> the Tomcat connection wrapper.  The getDelegate() method returns null 
> instead of an underlying connection.  How can I force the 
> wrapper to use 
>   AS400JDBCConnection or how do I gain access to it?
> 
> 
> server.xml:
> 
> <Context
>   path="/myapp">
>      <Resource
>       name="jdbc/myDB"
>       type="javax.sql.DataSource"
>       password="something"
>       driverClassName="com.ibm.as400.access.AS400JDBCDriver"
>       maxIdle="3"
>       maxWait="5000"
>       username="someone"
>       url="jdbc:as400://server;naming=system;libraries=lib1, 
> lib2;errors=full"
>       maxActive="10"/>
> </Context>
> 
> 
> code snipit:
> 
> . . .
> 
> InitialContext cxt = new InitialContext();
> 
> DataSource ds = (DataSource) cxt.lookup( "java:/comp/env/jdbc/myDB" );
> 
> DelegatingConnection dc = (DelegatingConnection) ds.getConnection();
> log(dc.getClass().getName() + ": " + dc);
> 
> Connection c = dc.getDelegate();
> log(c.getClass().getName() + ": " + c);
> 
> . . .
> 
> output:
> 
> INFO: Login: 
> org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnect
> ionWrapper: 
> [EMAIL PROTECTED]
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to