Thread:
 Getting the "actual" Oracle connection problem 
 branscomp   30 Apr 2004, 18:59 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: branscomp (30 Apr 2004, 18:59) Replies: 0, Views: 40469
Subject: Getting the "actual" Oracle connection problem
Yes the approach is fragile and I have experienced a problem using 
C3P0 connection pooling because the java.sql.Connection implementation 
that it supplies is a generated proxy and can never be cast to an 
oracle.jdbc.driver.OracleConnection nor can the native connection be 
obtained because the Connection interface, quite rightly, supports no 
such method. However I have found that the DatabaseMetaData instance 
returned from a call to getMetaData on this Connection proxy does 
return the native/original connection when you call its getConnection
() method. How about that. Have not tried this on any other connection 
pooling implementations though but it might be worth a go.

eg
DatabaseMetaData dbMetaData = st.getConnection().getMetaData
().getConnection()

seems bizarre I know but it works.

Paul Branscombe
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]