Package liquibase.database.core
Class OracleDatabase
- java.lang.Object
-
- liquibase.database.AbstractJdbcDatabase
-
- liquibase.database.core.OracleDatabase
-
- All Implemented Interfaces:
AutoCloseable
,Database
,PrioritizedService
public class OracleDatabase extends AbstractJdbcDatabase
Encapsulates Oracle database support.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
LONG_IDENTIFIERS_LEGNTH
static int
ORACLE_12C_MAJOR_VERSION
static int
ORACLE_23C_MAJOR_VERSION
static String
PRODUCT_NAME
static Pattern
PROXY_USER_PATTERN
protected int
SHORT_IDENTIFIERS_LENGTH
-
Fields inherited from class liquibase.database.AbstractJdbcDatabase
caseSensitive, currentDateTimeFunction, dateFunctions, defaultAutoIncrementBy, defaultAutoIncrementStartWith, defaultCatalogName, defaultSchemaName, quotingStrategy, sequenceCurrentValueFunction, sequenceNextValueFunction, unmodifiableDataTypes, unquotedObjectsAreUppercased
-
Fields inherited from interface liquibase.database.Database
COMPLETE_SQL_SCOPE_KEY
-
Fields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description OracleDatabase()
Default constructor for an object that represents the Oracle Database DBMS.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canAccessDbaRecycleBin()
String
generateDatabaseFunctionValue(DatabaseFunction databaseFunction)
Some function names are placeholders that need to be replaced with the specific database value.String
generatePrimaryKeyName(String tableName)
protected String
getAutoIncrementClause(String generationType, Boolean defaultOnNull)
Default implementation.protected String
getConnectionCatalogName()
int
getDatabaseMajorVersion()
int
getDatabaseMinorVersion()
int
getDataTypeMaxParameters(String dataTypeName)
String
getDateLiteral(String isoDate)
Returns an Oracle date literal with the same value as a string formatted using ISO 8601.String
getDbaRecycleBinWarning()
String
getDefaultCatalogName()
protected String
getDefaultDatabaseProductName()
String
getDefaultDriver(String url)
If this database understands the given url, return the default driver class name.Integer
getDefaultPort()
int
getIdentifierMaximumLength()
Returns the maximum number of bytes (NOT: characters) for an identifier.String
getJdbcCatalogName(CatalogAndSchema schema)
String
getJdbcSchemaName(CatalogAndSchema schema)
int
getPriority()
String
getShortName()
Returns an all-lower-case short name of the product.String
getSystemTableWhereClause(String tableNameColumn)
Set<String>
getUserDefinedTypes()
boolean
isCorrectDatabaseImplementation(DatabaseConnection conn)
Is this AbstractDatabase subclass the correct one to use for the given connection.boolean
isReservedWord(String objectName)
boolean
isSystemObject(DatabaseObject example)
boolean
isValidOracleIdentifier(String identifier, Class<? extends DatabaseObject> type)
Tests if the given String would be a valid identifier in Oracle DBMS.boolean
jdbcCallsCatalogsSchemas()
void
setConnection(DatabaseConnection conn)
boolean
supportsAutoIncrement()
boolean
supportsDatabaseChangeLogHistory()
Does the particular database implementation support the database changelog history feature and associated table?boolean
supportsInitiallyDeferrableColumns()
Returns whether this database support initially deferrable columns.boolean
supportsNotNullConstraintNames()
Does this database treat NOT NULL as an own kind of CONSTRAINT (in addition of simply being a column property)? This will affect the CONSTRAINT clause SQL generators.boolean
supportsRestrictForeignKeys()
boolean
supportsSchemas()
Oracle supports catalogs in liquibase termsboolean
supportsSequences()
Does the database type support sequence.boolean
supportsTablespaces()
ValidationErrors
validate()
-
Methods inherited from class liquibase.database.AbstractJdbcDatabase
addReservedWords, canCreateChangeLogTable, close, commit, correctObjectName, correctSchema, correctSchema, createsIndexesForForeignKeys, dataTypeIsNotModifiable, disableForeignKeyChecks, doesTagExist, dropDatabaseObjects, enableForeignKeyChecks, equals, escapeColumnName, escapeColumnName, escapeColumnNameList, escapeConstraintName, escapeDataTypeName, escapeIndexName, escapeObjectName, escapeObjectName, escapeSequenceName, escapeStringForDatabase, escapeTableName, escapeViewName, execute, executeRollbackStatements, executeRollbackStatements, executeStatements, filterRollbackVisitors, generateAutoIncrementBy, generateAutoIncrementStartWith, get, getAutoCommitMode, getAutoIncrementByClause, getAutoIncrementClause, getAutoIncrementClause, getAutoIncrementClosing, getAutoIncrementOpening, getAutoIncrementStartWithClause, getConcatSql, getConnection, getConnectionSchemaName, getConnectionSchemaNameCallStatement, getContainingObjects, getCurrentDateTimeFunction, getDatabaseChangeLogLockTableName, getDatabaseChangeLogTableName, getDatabaseProductName, getDatabaseProductVersion, getDateFunctions, getDateLiteral, getDateLiteral, getDateTimeLiteral, getDefaultFractionalDigitsForTimestamp, getDefaultScaleForNativeDataType, getDefaultSchema, getDefaultSchemaName, getFetchSize, getJdbcCatalogName, getJdbcSchemaName, getLineComment, getLiquibaseCatalogName, getLiquibaseSchemaName, getLiquibaseTablespaceName, getMaxFractionalDigitsForTimestamp, getName, getObjectQuotingStrategy, getOutputDefaultCatalog, getOutputDefaultSchema, getQuotingEndCharacter, getQuotingEndReplacement, getQuotingStartCharacter, getRanChangeSet, getRanChangeSetList, getRanDate, getRawDatabaseChangeLogLockTableName, getRawDatabaseChangeLogTableName, getRunStatus, getSchemaAndCatalogCase, getSchemaFromJdbcInfo, getSystemSchema, getSystemTables, getSystemViews, getTimeLiteral, getViewDefinition, hashCode, isAutoCommit, isCaseSensitive, isCatalogOrSchemaType, isCurrentTimeFunction, isDateOnly, isDateTime, isDefaultCatalog, isDefaultSchema, isFunction, isLiquibaseObject, isSafeToRunUpdate, isSystemView, isTimeOnly, isTimestamp, markChangeSetExecStatus, mustQuoteObjectName, parseDate, quoteObject, removeRanStatus, requiresExplicitNullForColumns, requiresPassword, requiresUsername, resetInternalState, rollback, saveRollbackStatement, saveStatements, set, setAutoCommit, setCanCacheLiquibaseTableInfo, setCaseSensitive, setCurrentDateTimeFunction, setDatabaseChangeLogLockTableName, setDatabaseChangeLogTableName, setDefaultCatalogName, setDefaultSchemaName, setLiquibaseCatalogName, setLiquibaseSchemaName, setLiquibaseTablespaceName, setObjectQuotingStrategy, setOutputDefaultCatalog, setOutputDefaultSchema, startsWithNumeric, supportsBatchUpdates, supportsCatalogInObjectName, supportsCatalogs, supportsDDLInTransaction, supportsDropTableCascadeConstraints, supportsForeignKeyDisable, supportsPrimaryKeyNames, tag, toString, unescapeDataTypeName, unescapeDataTypeString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface liquibase.database.Database
addCompleteSqlToScope, afterUpdate, dropDatabaseObjects, failOnDefferable, getDisplayName, supportsCreateIfNotExists, temporarilySetObjectQuotingStrategy
-
-
-
-
Field Detail
-
PROXY_USER_PATTERN
public static final Pattern PROXY_USER_PATTERN
-
PRODUCT_NAME
public static final String PRODUCT_NAME
- See Also:
- Constant Field Values
-
SHORT_IDENTIFIERS_LENGTH
protected final int SHORT_IDENTIFIERS_LENGTH
- See Also:
- Constant Field Values
-
LONG_IDENTIFIERS_LEGNTH
protected final int LONG_IDENTIFIERS_LEGNTH
- See Also:
- Constant Field Values
-
ORACLE_12C_MAJOR_VERSION
public static final int ORACLE_12C_MAJOR_VERSION
- See Also:
- Constant Field Values
-
ORACLE_23C_MAJOR_VERSION
public static final int ORACLE_23C_MAJOR_VERSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getPriority
public int getPriority()
-
setConnection
public void setConnection(DatabaseConnection conn)
- Specified by:
setConnection
in interfaceDatabase
- Overrides:
setConnection
in classAbstractJdbcDatabase
-
getShortName
public String getShortName()
Description copied from interface:Database
Returns an all-lower-case short name of the product. Used for end-user selecting of database type such as the DBMS precondition.
-
getDefaultDatabaseProductName
protected String getDefaultDatabaseProductName()
- Specified by:
getDefaultDatabaseProductName
in classAbstractJdbcDatabase
-
getDatabaseMajorVersion
public int getDatabaseMajorVersion() throws DatabaseException
- Specified by:
getDatabaseMajorVersion
in interfaceDatabase
- Overrides:
getDatabaseMajorVersion
in classAbstractJdbcDatabase
- Throws:
DatabaseException
-
getDatabaseMinorVersion
public int getDatabaseMinorVersion() throws DatabaseException
- Specified by:
getDatabaseMinorVersion
in interfaceDatabase
- Overrides:
getDatabaseMinorVersion
in classAbstractJdbcDatabase
- Throws:
DatabaseException
-
getDefaultPort
public Integer getDefaultPort()
-
getJdbcCatalogName
public String getJdbcCatalogName(CatalogAndSchema schema)
- Overrides:
getJdbcCatalogName
in classAbstractJdbcDatabase
-
getJdbcSchemaName
public String getJdbcSchemaName(CatalogAndSchema schema)
- Overrides:
getJdbcSchemaName
in classAbstractJdbcDatabase
-
getAutoIncrementClause
protected String getAutoIncrementClause(String generationType, Boolean defaultOnNull)
Description copied from class:AbstractJdbcDatabase
Default implementation. Intended for override in database specific cases- Overrides:
getAutoIncrementClause
in classAbstractJdbcDatabase
-
generatePrimaryKeyName
public String generatePrimaryKeyName(String tableName)
- Specified by:
generatePrimaryKeyName
in interfaceDatabase
- Overrides:
generatePrimaryKeyName
in classAbstractJdbcDatabase
-
supportsInitiallyDeferrableColumns
public boolean supportsInitiallyDeferrableColumns()
Description copied from interface:Database
Returns whether this database support initially deferrable columns.
-
isReservedWord
public boolean isReservedWord(String objectName)
- Specified by:
isReservedWord
in interfaceDatabase
- Overrides:
isReservedWord
in classAbstractJdbcDatabase
-
supportsSequences
public boolean supportsSequences()
Description copied from class:AbstractJdbcDatabase
Does the database type support sequence.- Specified by:
supportsSequences
in interfaceDatabase
- Overrides:
supportsSequences
in classAbstractJdbcDatabase
-
supportsSchemas
public boolean supportsSchemas()
Oracle supports catalogs in liquibase terms- Specified by:
supportsSchemas
in interfaceDatabase
- Overrides:
supportsSchemas
in classAbstractJdbcDatabase
- Returns:
- false
-
getConnectionCatalogName
protected String getConnectionCatalogName() throws DatabaseException
- Overrides:
getConnectionCatalogName
in classAbstractJdbcDatabase
- Throws:
DatabaseException
-
isCorrectDatabaseImplementation
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException
Description copied from interface:Database
Is this AbstractDatabase subclass the correct one to use for the given connection.- Throws:
DatabaseException
-
getDefaultDriver
public String getDefaultDriver(String url)
Description copied from interface:Database
If this database understands the given url, return the default driver class name. Otherwise return null.
-
getDefaultCatalogName
public String getDefaultCatalogName()
- Specified by:
getDefaultCatalogName
in interfaceDatabase
- Overrides:
getDefaultCatalogName
in classAbstractJdbcDatabase
-
getDateLiteral
public String getDateLiteral(String isoDate)
Returns an Oracle date literal with the same value as a string formatted using ISO 8601.
Convert an ISO8601 date string to one of the following results: to_date('1995-05-23', 'YYYY-MM-DD') to_date('1995-05-23 09:23:59', 'YYYY-MM-DD HH24:MI:SS')
Implementation restriction:
Currently, only the following subsets of ISO8601 are supported:
- YYYY-MM-DD
- YYYY-MM-DDThh:mm:ss
- Specified by:
getDateLiteral
in interfaceDatabase
- Overrides:
getDateLiteral
in classAbstractJdbcDatabase
-
isSystemObject
public boolean isSystemObject(DatabaseObject example)
- Specified by:
isSystemObject
in interfaceDatabase
- Overrides:
isSystemObject
in classAbstractJdbcDatabase
-
supportsTablespaces
public boolean supportsTablespaces()
-
supportsAutoIncrement
public boolean supportsAutoIncrement()
- Specified by:
supportsAutoIncrement
in interfaceDatabase
- Overrides:
supportsAutoIncrement
in classAbstractJdbcDatabase
-
supportsRestrictForeignKeys
public boolean supportsRestrictForeignKeys()
- Specified by:
supportsRestrictForeignKeys
in interfaceDatabase
- Overrides:
supportsRestrictForeignKeys
in classAbstractJdbcDatabase
-
getDataTypeMaxParameters
public int getDataTypeMaxParameters(String dataTypeName)
- Specified by:
getDataTypeMaxParameters
in interfaceDatabase
- Overrides:
getDataTypeMaxParameters
in classAbstractJdbcDatabase
-
jdbcCallsCatalogsSchemas
public boolean jdbcCallsCatalogsSchemas()
- Overrides:
jdbcCallsCatalogsSchemas
in classAbstractJdbcDatabase
-
generateDatabaseFunctionValue
public String generateDatabaseFunctionValue(DatabaseFunction databaseFunction)
Description copied from interface:Database
Some function names are placeholders that need to be replaced with the specific database value. e.g. nextSequenceValue(sequenceName) should be replaced with NEXT_VAL('sequenceName') for Postgresql- Specified by:
generateDatabaseFunctionValue
in interfaceDatabase
- Overrides:
generateDatabaseFunctionValue
in classAbstractJdbcDatabase
- Parameters:
databaseFunction
- database function to check.- Returns:
- the string value to use for an update or generate
-
validate
public ValidationErrors validate()
- Specified by:
validate
in interfaceDatabase
- Overrides:
validate
in classAbstractJdbcDatabase
-
getDbaRecycleBinWarning
public String getDbaRecycleBinWarning()
-
canAccessDbaRecycleBin
public boolean canAccessDbaRecycleBin()
-
supportsNotNullConstraintNames
public boolean supportsNotNullConstraintNames()
Description copied from interface:Database
Does this database treat NOT NULL as an own kind of CONSTRAINT (in addition of simply being a column property)? This will affect the CONSTRAINT clause SQL generators.- Specified by:
supportsNotNullConstraintNames
in interfaceDatabase
- Overrides:
supportsNotNullConstraintNames
in classAbstractJdbcDatabase
- Returns:
- true if the database supports naming NOT NULL constraints, false if not.
-
isValidOracleIdentifier
public boolean isValidOracleIdentifier(String identifier, Class<? extends DatabaseObject> type)
Tests if the given String would be a valid identifier in Oracle DBMS. In Oracle, a valid identifier has the following form (case-insensitive comparison): 1st character: A-Z 2..n characters: A-Z0-9$_# The maximum length of an identifier differs by Oracle version and object type.
-
getIdentifierMaximumLength
public int getIdentifierMaximumLength()
Returns the maximum number of bytes (NOT: characters) for an identifier. For Oracle <=12c Release 20, this is 30 bytes, and starting from 12cR2, up to 128 (except for tablespaces, PDB names and some other rather rare object types).- Returns:
- the maximum length of an object identifier, in bytes
-
supportsDatabaseChangeLogHistory
public boolean supportsDatabaseChangeLogHistory()
Description copied from interface:Database
Does the particular database implementation support the database changelog history feature and associated table?- Returns:
- true if supported, false otherwise
-
-