Class OracleDatabaseType
- java.lang.Object
-
- migratedb.core.internal.database.base.BaseDatabaseType
-
- migratedb.core.internal.database.oracle.OracleDatabaseType
-
- All Implemented Interfaces:
DatabaseType
public class OracleDatabaseType extends BaseDatabaseType
-
-
Field Summary
-
Fields inherited from class migratedb.core.internal.database.base.BaseDatabaseType
APPLICATION_NAME, LOG
-
-
Constructor Summary
Constructors Constructor Description OracleDatabaseType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidalterConnectionAsNeeded(Connection connection, Configuration configuration)Carries out any manipulation on the Connection that is required by MigrateDB's configDatabase<?>createDatabase(Configuration configuration, JdbcConnectionFactory jdbcConnectionFactory)Initializes the Database used by this Database Type.BaseParsercreateParser(Configuration configuration, ResourceProvider resourceProvider, ParsingContext parsingContext)Initializes the Parser used by this Database Type.SqlScriptExecutorFactorycreateSqlScriptExecutorFactory(JdbcConnectionFactory jdbcConnectionFactory, CallbackExecutor callbackExecutor)Initializes the SqlScriptExecutorFactory used by this Database Type.booleandetectPasswordRequiredByUrl(String url)Detects whether a password is required from configuration.booleandetectUserRequiredByUrl(String url)Detects whether a user is required from configuration.StringgetDriverClass(String url, ClassLoader classLoader)Get the driver class used to handle this JDBC url.PatterngetJDBCCredentialsPattern()A regex that identifies credentials in the JDBC URL, where they conform to a pattern specific to this database.StringgetName()intgetNullType()booleanhandlesDatabaseProductNameAndVersion(String databaseProductName, String databaseProductVersion, Connection connection)This allows more fine-grained control over which DatabaseType handles which connection.booleanhandlesJDBCUrl(String url)Whether this database type should handle the given JDBC url.voidmodifyConfigConnectionProps(Configuration config, Properties props, ClassLoader classLoader)Set any necessary connection properties based on MigrateDB's configuration.voidmodifyDefaultConnectionProps(String url, Properties props, ClassLoader classLoader)Set the default connection properties for this database.-
Methods inherited from class migratedb.core.internal.database.base.BaseDatabaseType
createDatabase, createExecutionStrategy, createSqlScriptFactory, createTransactionalExecutionTemplate, externalAuthPropertiesRequired, getBackupDriverClass, getDefaultJDBCCredentialsPattern, getExternalAuthProperties, getPriority, getSelectVersionOutput, instantiateClassExtendedErrorMessage, modifyOverridingConnectionProps, shutdownDatabase, toString
-
-
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getNamein interfaceDatabaseType- Specified by:
getNamein classBaseDatabaseType- Returns:
- The human-readable name for this database.
-
getNullType
public int getNullType()
- Specified by:
getNullTypein interfaceDatabaseType- Specified by:
getNullTypein classBaseDatabaseType- Returns:
- The JDBC type used to represent
nullin prepared statements.
-
handlesJDBCUrl
public boolean handlesJDBCUrl(String url)
Description copied from class:BaseDatabaseTypeWhether this database type should handle the given JDBC url.- Specified by:
handlesJDBCUrlin interfaceDatabaseType- Specified by:
handlesJDBCUrlin classBaseDatabaseType- Parameters:
url- The JDBC url.- Returns:
trueif this handles the JDBC url,falseif not.
-
getJDBCCredentialsPattern
public Pattern getJDBCCredentialsPattern()
Description copied from class:BaseDatabaseTypeA regex that identifies credentials in the JDBC URL, where they conform to a pattern specific to this database. The first captured group should represent the password text, so that it can be redacted if necessary.- Specified by:
getJDBCCredentialsPatternin interfaceDatabaseType- Overrides:
getJDBCCredentialsPatternin classBaseDatabaseType- Returns:
- The URL regex.
-
getDriverClass
public String getDriverClass(String url, ClassLoader classLoader)
Description copied from interface:DatabaseTypeGet the driver class used to handle this JDBC url. This will only be called ifmatchesJDBCUrlpreviously returnedtrue.- Specified by:
getDriverClassin interfaceDatabaseType- Specified by:
getDriverClassin classBaseDatabaseType- Parameters:
url- The JDBC url.classLoader- The classLoader to check for driver classes.- Returns:
- The full driver class name to be instantiated to handle this url.
-
handlesDatabaseProductNameAndVersion
public boolean handlesDatabaseProductNameAndVersion(String databaseProductName, String databaseProductVersion, Connection connection)
Description copied from class:BaseDatabaseTypeThis allows more fine-grained control over which DatabaseType handles which connection. MigrateDB will use the first DatabaseType that returns true for this method.- Specified by:
handlesDatabaseProductNameAndVersionin interfaceDatabaseType- Specified by:
handlesDatabaseProductNameAndVersionin classBaseDatabaseType- Parameters:
databaseProductName- The product name returned by the database.databaseProductVersion- The product version returned by the database.connection- The connection used to connect to the database.- Returns:
trueif this handles the product name and version,falseif not.
-
createDatabase
public Database<?> createDatabase(Configuration configuration, JdbcConnectionFactory jdbcConnectionFactory)
Description copied from interface:DatabaseTypeInitializes the Database used by this Database Type.- Specified by:
createDatabasein interfaceDatabaseType- Specified by:
createDatabasein classBaseDatabaseType- Parameters:
configuration- The MigrateDB configuration.jdbcConnectionFactory- The current connection factory.- Returns:
- The Database.
-
createParser
public BaseParser createParser(Configuration configuration, ResourceProvider resourceProvider, ParsingContext parsingContext)
Description copied from interface:DatabaseTypeInitializes the Parser used by this Database Type.- Specified by:
createParserin interfaceDatabaseType- Specified by:
createParserin classBaseDatabaseType- Parameters:
configuration- The MigrateDB configuration.- Returns:
- The Parser.
-
createSqlScriptExecutorFactory
public SqlScriptExecutorFactory createSqlScriptExecutorFactory(JdbcConnectionFactory jdbcConnectionFactory, CallbackExecutor callbackExecutor)
Description copied from interface:DatabaseTypeInitializes the SqlScriptExecutorFactory used by this Database Type.- Specified by:
createSqlScriptExecutorFactoryin interfaceDatabaseType- Overrides:
createSqlScriptExecutorFactoryin classBaseDatabaseType- Parameters:
jdbcConnectionFactory- The current connection factory.- Returns:
- The SqlScriptExecutorFactory.
-
modifyDefaultConnectionProps
public void modifyDefaultConnectionProps(String url, Properties props, ClassLoader classLoader)
Description copied from class:BaseDatabaseTypeSet the default connection properties for this database. These can be overridden bysetConfigConnectionPropsandsetOverridingConnectionProps.- Specified by:
modifyDefaultConnectionPropsin interfaceDatabaseType- Overrides:
modifyDefaultConnectionPropsin classBaseDatabaseType- Parameters:
url- The JDBC url.props- The properties to write to.classLoader- The classLoader to use.
-
modifyConfigConnectionProps
public void modifyConfigConnectionProps(Configuration config, Properties props, ClassLoader classLoader)
Description copied from class:BaseDatabaseTypeSet any necessary connection properties based on MigrateDB's configuration. These can be overridden bysetOverridingConnectionProps.- Specified by:
modifyConfigConnectionPropsin interfaceDatabaseType- Overrides:
modifyConfigConnectionPropsin classBaseDatabaseType- Parameters:
config- The MigrateDB configuration to read properties from.props- The properties to write to.classLoader- The classLoader to use.
-
detectUserRequiredByUrl
public boolean detectUserRequiredByUrl(String url)
Description copied from class:BaseDatabaseTypeDetects whether a user is required from configuration. This may not be the case if the driver supports other authentication mechanisms, or supports the user being encoded in the URL.- Specified by:
detectUserRequiredByUrlin interfaceDatabaseType- Overrides:
detectUserRequiredByUrlin classBaseDatabaseType- Parameters:
url- The url to check- Returns:
- true if a username needs to be provided
-
detectPasswordRequiredByUrl
public boolean detectPasswordRequiredByUrl(String url)
Description copied from class:BaseDatabaseTypeDetects whether a password is required from configuration. This may not be the case if the driver supports other authentication mechanisms, or supports the password being encoded in the URL.- Specified by:
detectPasswordRequiredByUrlin interfaceDatabaseType- Overrides:
detectPasswordRequiredByUrlin classBaseDatabaseType- Parameters:
url- The url to check- Returns:
- true if a password needs to be provided
-
alterConnectionAsNeeded
public void alterConnectionAsNeeded(Connection connection, Configuration configuration)
Description copied from interface:DatabaseTypeCarries out any manipulation on the Connection that is required by MigrateDB's config- Specified by:
alterConnectionAsNeededin interfaceDatabaseType- Overrides:
alterConnectionAsNeededin classBaseDatabaseType- Parameters:
connection- The JDBC connection.configuration- The MigrateDB configuration.
-
-