Interface IDriverWrapper

All Known Implementing Classes:
MysqlDriverWrapper, PostgresDriverWrapper, RedshiftDriverWrapper, SqlServerDriverWrapper

public interface IDriverWrapper
A class for abstracting away the different terminology and parameters for obtaining JDBC data; for use in the GUI JDBC importing framework to make it friendlier for our users.
  • Method Details

    • friendlyName

      String friendlyName()
      Get the user-friendly name. For example "Mysql", "Oracle", "MS SQL Server" can be displayed to the user.
      Returns:
      a friendly name for this driver wrapper
    • driverClass

      String driverClass()
      The class used by JDBC for this driver.
      Returns:
      the name of the class to load for this driver
    • isValidUrl

      boolean isValidUrl(String uri)
      Check if this is a valid URL for this driver.
      Parameters:
      uri - the uri
      Returns:
      true if valid
    • getCatalogNames

      String[] getCatalogNames(Connection connection) throws SQLException
      Get the list of Catalogs. For our purposes, a catalog is simply a bucket of table names.

      Catalog matches the JDBC connection meta-data terminology; but does not map to all DBMSes.

      Parameters:
      connection - the JDBC connection
      Returns:
      an array of catalog names
      Throws:
      SQLException - when the underlying SQL operation fails
    • catalogName

      String catalogName()
      Define what the UI should use to describe a catalog.
      Returns:
      the name of the catalog type (e.g.,"SQL Database", "Database")
    • defaultUrl

      String defaultUrl()
      Define the default URL for this driver.
      Returns:
      the default URL
    • getTableNames

      String[] getTableNames(Connection connection, String catalogName) throws SQLException
      Get the list of tables within a catalog.
      Parameters:
      connection - the JDBC connection
      catalogName - the catalog to get names for
      Returns:
      an array of table names
      Throws:
      SQLException - when the underlying SQL operation fails
    • hasScrollableCursors

      boolean hasScrollableCursors()
      Return if the driver supports scrollable cursors.
      Returns:
      true if scrollable cursors are supported
    • getServerTimeZone

      TimeZone getServerTimeZone(Connection conn) throws SQLException
      Return the server time zone for interpreting datetime values.
      Parameters:
      conn - the JDBC connection
      Returns:
      the server time zone
      Throws:
      SQLException - when the underlying SQL operation fails
    • quoteEscapeTableName

      String quoteEscapeTableName(String schemaName, String tableName)
      Quote and escape a table name in accordance with the particular DBMS, for use in a query. Should handle unusual characters in table names (e.g. whitespace), if permitted by the DBAM, and prevent SQL injection attacks.
      Parameters:
      schemaName - the raw unquoted, unescaped schema name
      tableName - the raw unquoted, unescaped table name
      Returns:
      the quoted, escaped table name
    • quoteEscapeColumnName

      String quoteEscapeColumnName(String columnName)
      Quote and escape a column name in accordance with the particular DBMS, for use in a query. Should handle unusual characters in table names (e.g. whitespace), if permitted by the DBAM, and prevent SQL injection attacks.
      Parameters:
      columnName - the raw unquoted, unescaped column name
      Returns:
      the quoted, escaped table name
    • displayInfo

      default IDriverWrapper.DisplayInfo displayInfo()
      Creates a DisplayInfo object for this driver wrapper.
      Returns:
      display info for this driver wrapper.
    • load

      default void load() throws Exception
      Load the driver class.
      Throws:
      Exception - if the driver class cannot be loaded