Enum Class DatabaseType
- All Implemented Interfaces:
Serializable
,Comparable<DatabaseType>
,Constable
Enum representing a database type, such as DB2 or oracle. The type also contains a
product name, which is expected to be the same as the product name provided by the
database driver's metadata.
- Since:
- 2.0
- Author:
- Lucas Ward, Mahmoud Ben Hassine
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic DatabaseType
fromMetaData
(DataSource dataSource) Convenience method that pulls a database product name from the DataSource's metadata.static DatabaseType
fromProductName
(String productName) Static method to obtain a DatabaseType from the provided product name.static DatabaseType
Returns the enum constant of this class with the specified name.static DatabaseType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DERBY
-
DB2
-
DB2VSE
-
DB2ZOS
-
DB2AS400
-
HSQL
-
SQLSERVER
-
MYSQL
-
ORACLE
-
POSTGRES
-
SYBASE
-
H2
-
SQLITE
-
HANA
-
MARIADB
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException
- if the argument is null
-
getProductName
-
fromProductName
Static method to obtain a DatabaseType from the provided product name.- Parameters:
productName
-String
containing the product name.- Returns:
- the
DatabaseType
for given product name. - Throws:
IllegalArgumentException
- if none is found.
-
fromMetaData
public static DatabaseType fromMetaData(DataSource dataSource) throws org.springframework.jdbc.support.MetaDataAccessException Convenience method that pulls a database product name from the DataSource's metadata.- Parameters:
dataSource
-DataSource
to the database to be used.- Returns:
DatabaseType
for theDataSource
specified.- Throws:
org.springframework.jdbc.support.MetaDataAccessException
- thrown if error occured during Metadata lookup.
-