Package org.pjdbc.sql

Class ProxyConnection

All Implemented Interfaces:
AutoCloseable, Connection, Wrapper

public class ProxyConnection extends AbstractConnection
Base class for proxy connections that automatically delegates statement creation to the driver's proxy methods. This eliminates ~60 lines of boilerplate per driver.

Usage

Extend this class in your driver and implement any custom behavior:

 private class MyConnection extends ProxyConnection {
     private final MyConfig config;

     MyConnection(Connection conn, AbstractProxyDriver driver, String url, Properties info) throws SQLException {
         super(conn, driver, url, info);
         this.config = new MyConfig(url);
     }

     public MyConfig getConfig() { return config; }
 }
 

The driver must override the proxy methods (proxyStatement, proxyPreparedStatement, proxyCallableStatement) to provide custom statement wrappers.

See Also: