Package org.pjdbc.sql

Class AbstractDriver

java.lang.Object
org.pjdbc.sql.AbstractDriver
All Implemented Interfaces:
Driver
Direct Known Subclasses:
AbstractProxyDriver, FederatingDriver, MockDriver

public abstract class AbstractDriver extends Object implements Driver
  • Constructor Details

    • AbstractDriver

      public AbstractDriver()
  • Method Details

    • parseUrl

      protected JdbcUrlParser parseUrl(String url)
      Parse the URL and return the JdbcUrlParser, or null if invalid.
    • protocol

      protected String protocol(String url)
    • subprotocol

      protected String subprotocol(String url)
    • subname

      protected String subname(String url)
    • getUrlParameter

      protected String getUrlParameter(String url, String key)
      Get a URL parameter value.
      Parameters:
      url - the JDBC URL
      key - the parameter key
      Returns:
      the parameter value, or null if not found
    • getUrlParameter

      protected String getUrlParameter(String url, String key, String defaultValue)
      Get a URL parameter value with a default.
      Parameters:
      url - the JDBC URL
      key - the parameter key
      defaultValue - the default value if not found
      Returns:
      the parameter value, or the default if not found
    • getUrlParameters

      protected Map<String,String> getUrlParameters(String url)
      Get all URL parameters as a map.
      Parameters:
      url - the JDBC URL
      Returns:
      unmodifiable map of parameters, empty if none
    • validateParameters

      protected void validateParameters(String url) throws SQLException
      Validates URL parameters against @DriverParameter annotations on this driver class.

      Call this method at the beginning of Driver.connect(String, Properties) to validate parameters before using them. Throws SQLException with detailed error messages if validation fails.

      Parameters:
      url - the JDBC URL containing parameters
      Throws:
      SQLException - if parameter validation fails
    • acceptsProtocol

      protected boolean acceptsProtocol(String protocol)
    • acceptsSubProtocol

      protected abstract boolean acceptsSubProtocol(String subprotocol)
    • acceptsSubName

      protected abstract boolean acceptsSubName(String subname)
    • acceptsURL

      public boolean acceptsURL(String url)
      Specified by:
      acceptsURL in interface Driver
    • getMajorVersion

      public int getMajorVersion()
      Specified by:
      getMajorVersion in interface Driver
    • getMinorVersion

      public int getMinorVersion()
      Specified by:
      getMinorVersion in interface Driver
    • getParentLogger

      public Logger getParentLogger() throws SQLFeatureNotSupportedException
      Specified by:
      getParentLogger in interface Driver
      Throws:
      SQLFeatureNotSupportedException
    • getPropertyInfo

      public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException
      Specified by:
      getPropertyInfo in interface Driver
      Throws:
      SQLException
    • jdbcCompliant

      public boolean jdbcCompliant()
      Specified by:
      jdbcCompliant in interface Driver