Class JdbcUtils
- java.lang.Object
-
- org.apache.flink.connector.jdbc.utils.JdbcUtils
-
public class JdbcUtils extends Object
Utils for jdbc connectors.
-
-
Constructor Summary
Constructors Constructor Description JdbcUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.flink.types.RowgetPrimaryKey(org.apache.flink.types.Row row, int[] pkFields)static voidsetField(PreparedStatement upload, int type, Object field, int index)static voidsetRecordToStatement(PreparedStatement upload, int[] typesArray, org.apache.flink.types.Row row)Adds a record to the prepared statement.
-
-
-
Method Detail
-
setRecordToStatement
public static void setRecordToStatement(PreparedStatement upload, int[] typesArray, org.apache.flink.types.Row row) throws SQLException
Adds a record to the prepared statement.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))
- Parameters:
upload- The prepared statement.typesArray- The jdbc types of the row.row- The records to add to the output.- Throws:
SQLException- See Also:
PreparedStatement
-
setField
public static void setField(PreparedStatement upload, int type, Object field, int index) throws SQLException
- Throws:
SQLException
-
getPrimaryKey
public static org.apache.flink.types.Row getPrimaryKey(org.apache.flink.types.Row row, int[] pkFields)
-
-