Enum Class DatabaseType
- All Implemented Interfaces:
Serializable,Comparable<DatabaseType>,Constable
Database types supported by Polaris relational JDBC persistence.
CockroachDB uses the PostgreSQL wire protocol but has its own schema resources in the "cockroachdb" directory. While CockroachDB is PostgreSQL-compatible, having separate schemas allows for CockroachDB-specific optimizations and avoids experimental ALTER operations that CockroachDB doesn't fully support.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic DatabaseTypefromDisplayName(String displayName) intReturns the latest schema version available for this database type.static DatabaseTypeinferFromConnection(Connection connection, DatabaseType configuredType) Determines the database type from JDBC connection metadata and validates against configured type.openInitScriptResource(int schemaVersion) Open an InputStream that contains data from an init script.static DatabaseTypeReturns 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
-
POSTGRES
-
COCKROACHDB
-
H2
-
-
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
-
getDisplayName
-
getLatestSchemaVersion
public int getLatestSchemaVersion()Returns the latest schema version available for this database type. This is used as the default schema version for new installations. -
fromDisplayName
-
inferFromConnection
Determines the database type from JDBC connection metadata and validates against configured type.Logic:
- If configuredType is provided: uses it as the authoritative type and validates it matches what the connection reports. Throws an exception if there's a mismatch.
- If configuredType is null: infers the type from connection metadata.
- Parameters:
connection- JDBC connection to inspectconfiguredType- Explicitly configured database type (may be null)- Returns:
- The database type (configured if provided, otherwise inferred)
- Throws:
IllegalStateException- if configured type doesn't match connection metadata
-
openInitScriptResource
Open an InputStream that contains data from an init script. This stream should be closed by the caller.
-