code: private void proceedWithQuery
    (PreparedStatement queryStmt, DataSet ds) throws SQLException {
      if (queryArgs != null && queryArgs.length > 0) {
        for (int i=0; i < queryArgs.length; i++) {
          queryStmt.setObject(i + 1, queryArgs[i]);
        }
      }
      try(ResultSet rs = queryStmt.executeQuery()) {
        int colCount = metaData.getColumnCount();
        while (rs.next()) {
          Object[] data = new Object[colCount];
          for (int i = 0; i < colCount; i++) {  
            data[i] = rs.getObject(i+1);
          }
          ds.addRow(new Row(data));
        }
      }
    }
docs: Execute query.
  @param queryStmt Query statement.
  @param ds Target data set.
  @throws SQLException if a database error occurs.