Class JdbcUtils


  • public class JdbcUtils
    extends Object
    Utils for jdbc connectors.
    • Constructor Detail

      • JdbcUtils

        public JdbcUtils()
    • 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
      • getPrimaryKey

        public static org.apache.flink.types.Row getPrimaryKey​(org.apache.flink.types.Row row,
                                                               int[] pkFields)