This content has been marked as final.
Show 2 replies
-
1. Re: Can I access the drivers connection object
adrian.brock Apr 19, 2004 2:47 PM (in response to rupshall)Connection c = dataSource.getConnection(); org.jboss.resource.adapter.jdbc.WrappedConnection wc = (WrappedConnection) c; AS400JDBCConnection ajc = (AS400JDBCConnection) wc.getUnderlyingConnection();
Be careful. -
2. Re: Can I access the drivers connection object
ricardoarguello Apr 21, 2004 10:22 AM (in response to rupshall)If you don't want to import org.jboss.* classes into your project, you could do this:
public static OracleConnection getOracleConnection(Connection conFromPool) throws SQLException { try { Class[] parms = null; Method method = (conFromPool.getClass()).getMethod("getUnderlyingConnection", parms); return (OracleConnection) method.invoke(conFromPool, parms); } catch (InvocationTargetException ite) { throw new SQLException(ite.getMessage()); } catch (Exception e) { throw new SQLException(e.getMessage()); } }
Change OracleConnection with AS400JDBCConnection, or return Object and cast as needed.
Ricardo