jdbc-protolib/src/main/java/com/streamsets/pipeline/lib/jdbc/JdbcBaseRecordWriter.java
void lookupPrimaryKeys() throws StageException {
    Connection connection = null;
    try {
      connection = dataSource.getConnection();
      primaryKeyColumns = jdbcUtil.getPrimaryKeys(connection, schema, tableName);
    } catch (SQLException e) {
      String formattedError = jdbcUtil.formatSqlException(e);
      LOG.error(formattedError, e);
      throw new StageException(JdbcErrors.JDBC_17, tableName, formattedError);
    } finally {
      if (connection != null) {
        try {
          connection.close();
        } catch (SQLException e) {
          String formattedError = jdbcUtil.formatSqlException(e);
          LOG.error(formattedError, e);
        }
      }
    }
  }
void lookupPrimaryKeys() throws StageException {
    Connection connection = null;
    try {
      connection = dataSource.getConnection();
      primaryKeyColumns = jdbcUtil.getPrimaryKeys(connection, schema, tableName);
    } catch (SQLException e) {
      String formattedError = jdbcUtil.formatSqlException(e);
      LOG.error(formattedError, e);
      throw new StageException(JdbcErrors.JDBC_17, tableName, formattedError);
    } finally {
      if (connection != null) {
        try {
          connection.close();
        } catch (SQLException e) {
          String formattedError = jdbcUtil.formatSqlException(e);
          LOG.error(formattedError, e);
        }
      }
    }
  }
void lookupPrimaryKeys ( ) throws StageException { Connection connection = null ; try { connection = dataSource . getConnection ( ) ; primaryKeyColumns = jdbcUtil . getPrimaryKeys ( connection , schema , tableName ) ; } catch ( SQLException e ) { String formattedError = jdbcUtil . formatSqlException ( e ) ; LOG . error ( formattedError , e ) ; throw new StageException ( JdbcErrors . JDBC_17 , tableName , formattedError ) ; } finally { if ( connection != null ) { try { connection . close ( ) ; } catch ( SQLException e ) { String formattedError = jdbcUtil . formatSqlException ( e ) ; LOG . error ( formattedError , e ) ; } } } }
Access the database, obtain a list of primary key columns, and store them in primaryKeyColumns.
If table has no primary keys, primaryKeyColumns stays empty.

@throws StageException
Access the database obtain a list of primary key columns and store them in primaryKeyColumns . If table has no primary keys primaryKeyColumns stays empty .