public class JDBCOutputFormat
extends org.apache.flink.api.common.io.RichOutputFormat<org.apache.flink.api.table.Row>
Tuple,
DriverManager,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
JDBCOutputFormat.JDBCOutputFormatBuilder |
| Modifier and Type | Field and Description |
|---|---|
int[] |
typesArray |
| Constructor and Description |
|---|
JDBCOutputFormat() |
| Modifier and Type | Method and Description |
|---|---|
static JDBCOutputFormat.JDBCOutputFormatBuilder |
buildJDBCOutputFormat() |
void |
close()
Executes prepared statement and closes all resources of this instance.
|
void |
configure(org.apache.flink.configuration.Configuration parameters) |
void |
open(int taskNumber,
int numTasks)
Connects to the target database and initializes the prepared statement.
|
void |
writeRecord(org.apache.flink.api.table.Row row)
Adds a record to the prepared statement.
|
public void configure(org.apache.flink.configuration.Configuration parameters)
public void open(int taskNumber,
int numTasks)
throws IOException
taskNumber - The number of the parallel instance.IOException - Thrown, if the output could not be opened due to an
I/O problem.public void writeRecord(org.apache.flink.api.table.Row row)
throws IOException
When this method is called, the output format is guaranteed to be opened.
WARNING: this may fail when no column types specified (because a best effort approach is attempted in order to insert a null value but it's not guaranteed that the JDBC driver handles PreparedStatement.setObject(pos, null))row - The records to add to the output.IOException - Thrown, if the records could not be added due to an I/O problem.PreparedStatementpublic void close()
throws IOException
IOException - Thrown, if the input could not be closed properly.public static JDBCOutputFormat.JDBCOutputFormatBuilder buildJDBCOutputFormat()
Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.