Package adams.db
Class JDBC
- java.lang.Object
-
- adams.db.JDBC
-
public class JDBC extends Object
Utility class for JDBC.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static String
URL_H2
the expression to match a H2 JDBC URL.static String
URL_HSQLDB
the expression to match a HSQLDB JDBC URL.static String
URL_MYSQL
the expression to match a MySQL JDBC URL.static String
URL_POSTGRESQL
the expression to match a PostgreSQL JDBC URL.static String
URL_SQLITE
the expression to match a SQLite JDBC URL.
-
Constructor Summary
Constructors Constructor Description JDBC()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AbstractTypes
getTypes(AbstractDatabaseConnection conn)
Returns the appropriate types.static AbstractTypes
getTypes(String url)
Returns the appropriate types.static boolean
isH2(AbstractDatabaseConnection conn)
Checks whether this connection represents a H2 one.static boolean
isH2(String url)
Checks whether this JDBC url represents a H2 URL.static boolean
isHSQLDB(AbstractDatabaseConnection conn)
Checks whether this connection represents a HSQLDB one.static boolean
isHSQLDB(String url)
Checks whether this JDBC url represents a HSQLDB URL.static boolean
isMySQL(AbstractDatabaseConnection conn)
Checks whether this connection represents a MySQL one.static boolean
isMySQL(String url)
Checks whether this JDBC url represents a MySQL URL.static boolean
isPostgreSQL(AbstractDatabaseConnection conn)
Checks whether this connection represents a PostgreSQL one.static boolean
isPostgreSQL(String url)
Checks whether this JDBC url represents a PostgreSQL URL.static boolean
isSQLite(AbstractDatabaseConnection conn)
Checks whether this connection represents a SQLite one.static boolean
isSQLite(String url)
Checks whether this JDBC url represents a SQLite URL.static String
regexpKeyword(AbstractDatabaseConnection conn)
Returns the keyword for regular expression matching in queries.static String
regexpKeyword(String url)
Returns the keyword for regular expression matching in queries.
-
-
-
Field Detail
-
URL_MYSQL
public static final String URL_MYSQL
the expression to match a MySQL JDBC URL.- See Also:
- Constant Field Values
-
URL_POSTGRESQL
public static final String URL_POSTGRESQL
the expression to match a PostgreSQL JDBC URL.- See Also:
- Constant Field Values
-
URL_SQLITE
public static final String URL_SQLITE
the expression to match a SQLite JDBC URL.- See Also:
- Constant Field Values
-
URL_HSQLDB
public static final String URL_HSQLDB
the expression to match a HSQLDB JDBC URL.- See Also:
- Constant Field Values
-
URL_H2
public static final String URL_H2
the expression to match a H2 JDBC URL.- See Also:
- Constant Field Values
-
-
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(AbstractDatabaseConnection conn)
Returns the appropriate types.- Parameters:
conn
- the connection to use for identification- Returns:
- the types
- 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
-
-