@Internal public class JdbcBatchingOutputFormat<In,JdbcIn,JdbcExec extends JdbcBatchStatementExecutor<JdbcIn>> extends AbstractJdbcOutputFormat<In>
| Modifier and Type | Class and Description |
|---|---|
static class |
JdbcBatchingOutputFormat.Builder
Builder for a
JdbcBatchingOutputFormat. |
static interface |
JdbcBatchingOutputFormat.RecordExtractor<F,T>
An interface to extract a value from given argument.
|
static interface |
JdbcBatchingOutputFormat.StatementExecutorFactory<T extends JdbcBatchStatementExecutor<?>>
A factory for creating
JdbcBatchStatementExecutor instance. |
connectionProvider, DEFAULT_FLUSH_INTERVAL_MILLS, DEFAULT_FLUSH_MAX_SIZE| Constructor and Description |
|---|
JdbcBatchingOutputFormat(JdbcConnectionProvider connectionProvider,
JdbcExecutionOptions executionOptions,
JdbcBatchingOutputFormat.StatementExecutorFactory<JdbcExec> statementExecutorFactory,
JdbcBatchingOutputFormat.RecordExtractor<In,JdbcIn> recordExtractor) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addToBatch(In original,
JdbcIn extracted) |
protected void |
attemptFlush() |
static JdbcBatchingOutputFormat.Builder |
builder() |
void |
close()
Executes prepared statement and closes all resources of this instance.
|
void |
flush() |
void |
open(int taskNumber,
int numTasks)
Connects to the target database and initializes the prepared statement.
|
void |
updateExecutor(boolean reconnect) |
void |
writeRecord(In record) |
configure, getConnectionpublic JdbcBatchingOutputFormat(@Nonnull JdbcConnectionProvider connectionProvider, @Nonnull JdbcExecutionOptions executionOptions, @Nonnull JdbcBatchingOutputFormat.StatementExecutorFactory<JdbcExec> statementExecutorFactory, @Nonnull JdbcBatchingOutputFormat.RecordExtractor<In,JdbcIn> recordExtractor)
public void open(int taskNumber,
int numTasks)
throws IOException
open in interface org.apache.flink.api.common.io.OutputFormat<In>open in class AbstractJdbcOutputFormat<In>taskNumber - The number of the parallel instance.IOExceptionpublic final void writeRecord(In record) throws IOException
IOExceptionprotected void addToBatch(In original, JdbcIn extracted) throws SQLException
SQLExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class AbstractJdbcOutputFormat<In>IOExceptionprotected void attemptFlush()
throws SQLException
SQLExceptionpublic void close()
close in interface org.apache.flink.api.common.io.OutputFormat<In>close in class AbstractJdbcOutputFormat<In>public static JdbcBatchingOutputFormat.Builder builder()
public void updateExecutor(boolean reconnect)
throws SQLException,
ClassNotFoundException
SQLExceptionClassNotFoundExceptionCopyright © 2014–2021 The Apache Software Foundation. All rights reserved.