pentaho/pentaho-kettle · error · KettleDatabaseException

Unable to get list of rows from ResultSet :

Error message

Unable to get list of rows from ResultSet : 

What it means

A Database method iterating a ResultSet into a List<Object[]> caught an unexpected Exception while reading rows and rethrew it as a KettleDatabaseException with this generic message and the cause chained. The real reason is in 'e' — a fetch, conversion, or connection failure mid-read.

Solutions

  1. Inspect the chained cause for the concrete driver error
  2. Limit rows fetched (getFirstRows with a limit, add WHERE/LIMIT to the SQL)
  3. Check connection network stability and socket timeouts for long reads
  4. Verify the column types are convertible; CAST problematic columns in SQL

Example fix

// before
List<Object[]> rows = db.getRows(sql, null); // millions of rows
// after
List<Object[]> rows = db.getRows(sql, 10000); // bounded fetch via getFirstRows-style limit
Defensive patterns

Strategy: try-catch

Validate before calling

// limit work up front and verify connectivity
if (!db.getConnection().isValid(5)) throw new IllegalStateException("connection dead before getRows");
int limit = 1000; // prefer getFirstRows(sql, limit)

Type guard

null

Try / catch

try {
  List<Object[]> rows = db.getRows(sql, numRows);
} catch (KettleDatabaseException e) {
  Throwable c = e.getCause();
  if (c instanceof java.net.SocketTimeoutException || (c != null && c.getMessage() != null && c.getMessage().contains("Connection"))) {
    // reconnect & retry once
  }
  throw e;
}

Prevention

When it happens

Trigger: getRows(...)/getFirstRows(...) loops over rs.next()/getRow() that fail partway — connection dropped during iteration, JDBC type conversion error, or interrupted fetch with a monitor.

Common situations: Long-running result sets losing connection mid-read, driver unable to convert exotic column types to Kettle values, huge result sets hitting memory/timeouts, or cancelled statements.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/7ec6c4418c49c128. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/database/Database.java:4099

          } else {
            stop = true;
          }
          if ( monitor != null && limit > 0 ) {
            monitor.worked( 1 );
          }
          if ( monitor != null && monitor.isCanceled() ) {
            break;
          }
        }
        closeQuery( rset );
        if ( monitor != null ) {
          monitor.done();
        }
      }

      return result;
    } catch ( Exception e ) {
      throw new KettleDatabaseException( "Unable to get list of rows from ResultSet : ", e );
    }
  }

  /**
   * Iterates over the first 'limit' rows of the ResultSet obtained from the given SQL statement,
   * executing the given callback for each row. If limit <= 0, all rows are processed.
   *
   * @param sql      The SQL statement to execute
   * @param limit    The maximum number of rows to process (<=0 means unlimited)
   * @param callback The callback to execute for each row (receives Object[] row)
   * @throws KettleDatabaseException if something goes wrong
   */
  public void forEachRow( String sql, int limit, java.util.function.Consumer<Object[]> callback )
    throws KettleDatabaseException {
    try ( ResultSet rset = openQuery( sql ) ) {
      int count = 0;
      while ( rset != null && ( limit <= 0 || count < limit ) ) {
        Object[] row = getRow( rset );

View on GitHub (pinned to f3058517a1)