Enum DatabaseEngineDriver
- java.lang.Object
-
- java.lang.Enum<DatabaseEngineDriver>
-
- com.feedzai.commons.sql.abstraction.engine.DatabaseEngineDriver
-
- All Implemented Interfaces:
Serializable,Comparable<DatabaseEngineDriver>
public enum DatabaseEngineDriver extends Enum<DatabaseEngineDriver>
Utility Enumeration to access default information for Database Vendors.- Since:
- 2.0.0
- Author:
- Diogo Guerra (diogo.guerra@feedzai.com)
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringconnectionStringFor(String hostname, String database)Gets the JDBC connection string given the hostname and the database.abstract StringconnectionStringFor(String hostname, String database, int port)Gets the JDBC connection string given the hostname and the database.intdefaultPort()Gets the default port for this vendor.Stringdriver()Gets the driver.Stringengine()Gets the engine.static DatabaseEngineDriverfromDriver(String driverClass)Gets theDatabaseEngineDrivergiven the driver class.static DatabaseEngineDriverfromEngine(String engine)Gets theDatabaseEngineDrivergiven the engine.StringtoString()static DatabaseEngineDrivervalueOf(String name)Returns the enum constant of this type with the specified name.static DatabaseEngineDriver[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
H2
public static final DatabaseEngineDriver H2
The H2 Database vendor.
-
POSTGRES
public static final DatabaseEngineDriver POSTGRES
The PostgreSQL vendor.
-
COCKROACHDB
public static final DatabaseEngineDriver COCKROACHDB
The CockroachDB vendor.- Since:
- 2.5.0
-
SQLSERVER
public static final DatabaseEngineDriver SQLSERVER
The SQLServer vendor.
-
ORACLE
public static final DatabaseEngineDriver ORACLE
The Oracle vendor.
-
MYSQL
public static final DatabaseEngineDriver MYSQL
The MySQL vendor.
-
DB2
public static final DatabaseEngineDriver DB2
The DB2 vendor.
-
-
Method Detail
-
values
public static DatabaseEngineDriver[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DatabaseEngineDriver c : DatabaseEngineDriver.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DatabaseEngineDriver valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
fromEngine
public static DatabaseEngineDriver fromEngine(String engine)
Gets theDatabaseEngineDrivergiven the engine.- Parameters:
engine- The engine name.- Returns:
- The database engine.
-
fromDriver
public static DatabaseEngineDriver fromDriver(String driverClass)
Gets theDatabaseEngineDrivergiven the driver class.- Parameters:
driverClass- The driver class.- Returns:
- The database engine.
-
toString
public String toString()
- Overrides:
toStringin classEnum<DatabaseEngineDriver>
-
engine
public String engine()
Gets the engine.- Returns:
- The engine of this
DatabaseEngineDriver.
-
driver
public String driver()
Gets the driver.- Returns:
- The driver of this
DatabaseEngineDriver.
-
defaultPort
public int defaultPort() throws UnsupportedOperationExceptionGets the default port for this vendor.- Returns:
- The default port of the vendor.
- Throws:
UnsupportedOperationException- If the vendor is H2.
-
connectionStringFor
public String connectionStringFor(String hostname, String database)
Gets the JDBC connection string given the hostname and the database.- Parameters:
hostname- The hostname The hostname.database- The database.- Returns:
- The formatted string to create a JDBC connection.
-
connectionStringFor
public abstract String connectionStringFor(String hostname, String database, int port)
Gets the JDBC connection string given the hostname and the database.- Parameters:
hostname- The hostname The hostname.database- The database.port- The port.- Returns:
- The formatted string to create a JDBC connection.
-
-