Interface DatabaseType

All Known Implementing Classes:
BaseDatabaseType, BigQueryDatabaseType, CockroachDBDatabaseType, DB2DatabaseType, DerbyDatabaseType, FirebirdDatabaseType, H2DatabaseType, HSQLDBDatabaseType, IgniteThinDatabaseType, InformixDatabaseType, MariaDBDatabaseType, MySQLDatabaseType, OracleDatabaseType, PostgreSQLDatabaseType, RedshiftDatabaseType, SAPHANADatabaseType, SnowflakeDatabaseType, SpannerDatabaseType, SQLiteDatabaseType, SQLServerDatabaseType, SybaseASEJConnectDatabaseType, SybaseASEJTDSDatabaseType, SynapseDatabaseType, TestContainersDatabaseType, TiDBDatabaseType, YugabyteDBDatabaseType

public interface DatabaseType
Extension point for supported database types. Instances are unmodifiable.
  • Method Details

    • getName

      String getName()
      Returns:
      The human-readable name for this database type.
    • getNullType

      int getNullType()
      Returns:
      The JDBC type used to represent null in prepared statements.
    • getPriority

      int getPriority()
      When identifying database types, the priority with which this type will be used. High numbers indicate that this type will be used in preference to others.
    • handlesDatabaseProductNameAndVersion

      boolean handlesDatabaseProductNameAndVersion(String databaseProductName, String databaseProductVersion, Connection connection)
      Check if this database type handles the connection product name and version. This allows more fine-grained control over which DatabaseType handles which connection. MigrateDB will use the first DatabaseType that returns true for this method.
      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:
      true if this handles the product name and version, false if not.
    • createDatabase

      Database<?> createDatabase(Configuration configuration, boolean printInfo, JdbcConnectionFactory jdbcConnectionFactory)
      Initializes the Database class, and optionally prints some information.
      Parameters:
      configuration - The MigrateDB configuration.
      jdbcConnectionFactory - The current connection factory.
      printInfo - Where the DB info should be printed in the logs.
      Returns:
      The appropriate Database class.
    • createDatabase

      Database<?> createDatabase(Configuration configuration, JdbcConnectionFactory jdbcConnectionFactory)
      Initializes the Database used by this Database Type.
      Parameters:
      configuration - The MigrateDB configuration.
      jdbcConnectionFactory - The current connection factory.
      Returns:
      The Database.
    • createParser

      Parser createParser(Configuration configuration, ResourceProvider resourceProvider, ParsingContext parsingContext)
      Initializes the Parser used by this Database Type.
      Parameters:
      configuration - The MigrateDB configuration.
      Returns:
      The Parser.
    • createSqlScriptFactory

      SqlScriptFactory createSqlScriptFactory(Configuration configuration, ParsingContext parsingContext)
      Initializes the SqlScriptFactory used by this Database Type.
      Parameters:
      configuration - The MigrateDB configuration.
      Returns:
      The SqlScriptFactory.
    • createSqlScriptExecutorFactory

      SqlScriptExecutorFactory createSqlScriptExecutorFactory(JdbcConnectionFactory jdbcConnectionFactory, CallbackExecutor callbackExecutor)
      Initializes the SqlScriptExecutorFactory used by this Database Type.
      Parameters:
      jdbcConnectionFactory - The current connection factory.
      Returns:
      The SqlScriptExecutorFactory.
    • createExecutionStrategy

      DatabaseExecutionStrategy createExecutionStrategy(Connection connection)
      Initializes the DatabaseExecutionStrategy used by this Database Type.
      Returns:
      The DatabaseExecutionStrategy.
    • createTransactionalExecutionTemplate

      ExecutionTemplate createTransactionalExecutionTemplate(Connection connection, boolean rollbackOnException)
      Initializes the ExecutionTemplate used by this Database Type.
      Returns:
      The ExecutionTemplate.
    • alterConnectionAsNeeded

      void alterConnectionAsNeeded(Connection connection, Configuration configuration)
      Carries out any manipulation on the Connection that is required by MigrateDB's config
      Parameters:
      connection - The JDBC connection.
      configuration - The MigrateDB configuration.