public static void renameTable(final Connection connection,
                                   final String oldTableName,
                                   final String newTableName,
                                   final boolean isIdempotent) {

        if (doesTableExist(connection, oldTableName)) {
            String sql = "RENAME TABLE " + oldTableName + " TO " + newTableName;
            try {
                try (final PreparedStatement stmt = connection.prepareStatement(sql)) {
                    stmt.execute();
                }
            } catch (SQLException e) {
                throw new RuntimeException(
                        LogUtil.message("Error renaming table {} to {}.", oldTableName, newTableName), e);
            }
        } else {
            if (!isIdempotent) {
                throw new RuntimeException(LogUtil.message("Expecting table {} to exist", oldTableName));
            }
        }
    }
Attempts to connect to the database using the passed connection details. If it fails
it will log a warning, and keep retrying. The retry interval will steadily increase.
<p>
If the connection could not be established and the reason for the failure makes a
retry pointless, e.g. invalid password, then an exception will be thrown.
stroom-db-util/src/main/java/stroom/db/util/DbUtil.java