ConnectionWrapper(Connection con) { this.connection = (Connection) Proxy.newProxyInstance( con.getClass().getClassLoader(), con.getClass().getInterfaces(), this); m_originConnection = con; }
public static final Connection getConnection() throws SQLException { Connection conn = conns.get(); if (conn == null || conn.isClosed()) { conn = _getConnection(); if (conn == null) throw new SQLException("Unabled to get connection."); conns.set(conn); // RequestContext ctx = RequestContext.get(); // connectionContext.put( // Thread.currentThread().getId(), // new ConnectionContext(new Exception(), (ctx != null) ? ctx // .ip() : null, (ctx != null) ? ctx.uri() : null, // (ctx != null) ? ctx.request().getParameterMap() // : null)); } return (show_sql && !Proxy.isProxyClass(conn.getClass())) ? new _DebugConnection(conn).getConnection() : conn; }
/** * Returns the conn. * * @return Connection */ public Connection getConnection() { return (Connection) Proxy.newProxyInstance( conn.getClass().getClassLoader(), conn.getClass().getInterfaces(), this); }