jdbc-protolib/src/main/java/com/streamsets/pipeline/lib/jdbc/JdbcUtil.java
public List<String> getPrimaryKeys(Connection connection, String schema, String tableName) throws SQLException {
    String table = tableName;
    DatabaseMetaData metadata = connection.getMetaData();
    List<String> keys = new ArrayList<>();
    try (ResultSet result = metadata.getPrimaryKeys(getCatalog(connection, schema), schema, table)) {
      while (result.next()) {
        keys.add(result.getString(COLUMN_NAME));
      }
    }
    return keys;
  }
public List<String> getPrimaryKeys(Connection connection, String schema, String tableName) throws SQLException {
    String table = tableName;
    DatabaseMetaData metadata = connection.getMetaData();
    List<String> keys = new ArrayList<>();
    try (ResultSet result = metadata.getPrimaryKeys(getCatalog(connection, schema), schema, table)) {
      while (result.next()) {
        keys.add(result.getString(COLUMN_NAME));
      }
    }
    return keys;
  }
Wrapper for {@link java.sql.DatabaseMetaData#getPrimaryKeys(String, String, String)}

@param connection An open JDBC connection
@param tableName table name that is optionally fully qualified with a schema in the form schema.tableName
@return List of primary key column names for a table

@throws SQLException