Package adams.db

Class JDBC


  • public class JDBC
    extends Object
    Utility class for JDBC.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • JDBC

        public JDBC()
    • Method Detail

      • isMySQL

        public static boolean isMySQL​(String url)
        Checks whether this JDBC url represents a MySQL URL.
        Parameters:
        url - the URL to check
        Returns:
        true if MySQL URL
        See Also:
        URL_MYSQL
      • isMySQL

        public static boolean isMySQL​(AbstractDatabaseConnection conn)
        Checks whether this connection represents a MySQL one.
        Parameters:
        conn - the connection to check
        Returns:
        true if MySQL URL
        See Also:
        isMySQL(String)
      • isPostgreSQL

        public static boolean isPostgreSQL​(String url)
        Checks whether this JDBC url represents a PostgreSQL URL.
        Parameters:
        url - the URL to check
        Returns:
        true if PostgreSQL URL
        See Also:
        URL_POSTGRESQL
      • isPostgreSQL

        public static boolean isPostgreSQL​(AbstractDatabaseConnection conn)
        Checks whether this connection represents a PostgreSQL one.
        Parameters:
        conn - the connection to check
        Returns:
        true if PostgreSQL URL
        See Also:
        isPostgreSQL(String)
      • isSQLite

        public static boolean isSQLite​(String url)
        Checks whether this JDBC url represents a SQLite URL.
        Parameters:
        url - the URL to check
        Returns:
        true if SQLite URL
        See Also:
        URL_SQLITE
      • isSQLite

        public static boolean isSQLite​(AbstractDatabaseConnection conn)
        Checks whether this connection represents a SQLite one.
        Parameters:
        conn - the connection to check
        Returns:
        true if SQLite URL
        See Also:
        isSQLite(String)
      • isH2

        public static boolean isH2​(String url)
        Checks whether this JDBC url represents a H2 URL.
        Parameters:
        url - the URL to check
        Returns:
        true if H2 URL
        See Also:
        URL_H2
      • isH2

        public static boolean isH2​(AbstractDatabaseConnection conn)
        Checks whether this connection represents a H2 one.
        Parameters:
        conn - the connection to check
        Returns:
        true if h2 URL
        See Also:
        isH2(String)
      • isHSQLDB

        public static boolean isHSQLDB​(String url)
        Checks whether this JDBC url represents a HSQLDB URL.
        Parameters:
        url - the URL to check
        Returns:
        true if HSQLDB URL
        See Also:
        URL_HSQLDB
      • isHSQLDB

        public static boolean isHSQLDB​(AbstractDatabaseConnection conn)
        Checks whether this connection represents a HSQLDB one.
        Parameters:
        conn - the connection to check
        Returns:
        true if HSQLDB URL
        See Also:
        isHSQLDB(String)
      • regexpKeyword

        public static String regexpKeyword​(AbstractDatabaseConnection conn)
        Returns the keyword for regular expression matching in queries.
        Parameters:
        conn - the connection to retrieve the keyword for
        Returns:
        the keyword
        Throws:
        IllegalArgumentException - if JDBC connection type not supported
      • regexpKeyword

        public static String regexpKeyword​(String url)
        Returns the keyword for regular expression matching in queries.
        Parameters:
        url - the connection to retrieve the keyword for
        Returns:
        the keyword
        Throws:
        IllegalArgumentException - if JDBC connection type not supported
      • getTypes

        public static AbstractTypes getTypes​(String url)
        Returns the appropriate types.
        Parameters:
        url - the URL to use for identification
        Returns:
        the types
        Throws:
        IllegalArgumentException - if JDBC connection type not supported