public synchronized void flush() {
        try {
            jdbcWriter.executeBatch(connection);
        } catch (SQLException e) {
            String errorMsg = String.format(
                "Writing records to JDBC failed. Cause: [%s]",
                ExceptionTrace.traceOriginalCause(e));
            throw new RuntimeException(errorMsg);
        } finally {
            batchCount = 0;
        }
    }
Connects to the target database and initializes the prepared statement.

@param taskNumber The number of the parallel instance.
@throws IOException Thrown, if the output could not be opened due to an
                    I/O problem.
rdb/rdb-sink/src/main/java/com/dtstack/flink/sql/sink/rdb/format/JDBCUpsertOutputFormat.java