Enum JdbcUtils

    • Method Detail

      • values

        public static JdbcUtils[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (JdbcUtils c : JdbcUtils.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static JdbcUtils valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
        NullPointerException - if the argument is null
      • openConnection

        public static Connection openConnection​(DataSource dataSource,
                                                int connectRetries,
                                                int connectRetriesInterval,
                                                DatabaseTypeRegister databaseTypeRegister)
                                         throws MigrateDbException
        Opens a new connection from dataSource.
        Parameters:
        dataSource - The dataSource to obtain the connection from.
        connectRetries - The maximum number of retries when attempting to connect to the database.
        connectRetriesInterval - The maximum time between retries in seconds
        Returns:
        The new connection.
        Throws:
        MigrateDbException - if the connection could not be opened.
      • closeConnection

        public static void closeConnection​(Connection connection)
        Quietly closes this connection. This method never throws an exception even if closing the connection fails.
      • closeStatement

        public static void closeStatement​(Statement statement)
        Quietly closes this statement. This method never throws an exception even if closing the connection fails.
      • closeResultSet

        public static void closeResultSet​(ResultSet resultSet)
        Quietly closes this resultSet. This method never throws an exception even if closing the connection fails.
      • getDatabaseProductName

        public static String getDatabaseProductName​(DatabaseMetaData databaseMetaData)
        Returns:
        The name of the database product. Example: Oracle, MySQL, ...
      • getDatabaseProductVersion

        public static String getDatabaseProductVersion​(DatabaseMetaData databaseMetaData)
        Returns:
        The version of the database product. Example: MariaDB 10.3, ...