{"record":{"id":"f155e48e8c16155a","repo":"pentaho/pentaho-kettle","slug":"couldn-t-get-row-from-result-set","errorCode":null,"errorMessage":"Couldn't get row from result set","messagePattern":"Couldn't get row from result set","errorType":"exception","errorClass":"KettleDatabaseException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/database/Database.java","lineNumber":3035,"sourceCode":"      // when multiple Database objects share the same connection and access ResultSets concurrently\n      synchronized ( connection ) {\n        int nrcols = rowInfo.size();\n        Object[] data = RowDataUtil.allocateRowData( nrcols );\n\n        if ( rs.next() ) {\n          for ( int i = 0; i < nrcols; i++ ) {\n            ValueMetaInterface val = rowInfo.getValueMeta( i );\n\n            data[ i ] = databaseMeta.getValueFromResultSet( rs, val, i );\n          }\n        } else {\n          data = null;\n        }\n\n        return data;\n      }\n    } catch ( Exception ex ) {\n      throw new KettleDatabaseException( \"Couldn't get row from result set\", ex );\n    } finally {\n      if ( log.isGatheringMetrics() ) {\n        long time = System.currentTimeMillis() - startTime;\n        log.snap( Metrics.METRIC_DATABASE_GET_ROW_SUM_TIME, databaseMeta.getName(), time );\n        log.snap( Metrics.METRIC_DATABASE_GET_ROW_MIN_TIME, databaseMeta.getName(), time );\n        log.snap( Metrics.METRIC_DATABASE_GET_ROW_MAX_TIME, databaseMeta.getName(), time );\n        log.snap( Metrics.METRIC_DATABASE_GET_ROW_COUNT, databaseMeta.getName() );\n      }\n    }\n  }\n\n  public void printSQLException( SQLException ex ) {\n    log.logError( \"==> SQLException: \" );\n    while ( ex != null ) {\n      log.logError( \"Message:   \" + ex.getMessage() );\n      log.logError( \"SQLState:  \" + ex.getSQLState() );\n      log.logError( \"ErrorCode: \" + ex.getErrorCode() );\n      ex = ex.getNextException();","sourceCodeStart":3017,"sourceCodeEnd":3053,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/database/Database.java#L3017-L3053","documentation":"Generic KettleDatabaseException wrapper thrown by Database.getRow(ResultSet, RowMetaInterface) for any Exception during row value extraction (getValue/KettleValueException, SQLException on rs.getObject, etc.). It is the catch-all for converting the current result set row into an Object[].","triggerScenarios":"Any failure while reading the current row: rs.getObject/getXXX throws SQLException, a column value can't be converted to the mapped Kettle type (KettleValueException), lazy conversion decode fails, or numeric/date conversion errors.","commonSituations":"Corrupt or truncated column values; charset/encoding mismatches on string columns; date/timestamp values out of supported range; driver errors mid-stream on large result sets; network interruption during fetch.","solutions":["Read the chained cause to identify the failing column and conversion","Check character encoding/database session encoding for garbled strings","Fetch in smaller batches / re-execute if the connection dropped mid-fetch","Enable lazy conversion off/on to bypass lazy-decoding problems, and upgrade the driver"],"exampleFix":"// before\nObject[] row = db.getRow(rs, rowMeta);\n// after\ntry {\n  Object[] row = db.getRow(rs, rowMeta);\n} catch (KettleDatabaseException e) {\n  Throwable root = ExceptionUtils.getRootCauseException(e);\n  logError(\"Row fetch failed: \" + root.getMessage());\n  throw e; // or skip the row\n}","handlingStrategy":"try-catch","validationCode":"// validate expected column types before reading\nResultSetMetaData md = rs.getMetaData();\nfor (int i = 1; i <= md.getColumnCount(); i++) {\n  // confirm type maps to expected Kettle type\n}","typeGuard":"null","tryCatchPattern":"try {\n  data = db.getRow(rs, rowMeta);\n} catch (KettleDatabaseException e) {\n  logError(\"Row read failed: \" + ExceptionUtils.getRootCauseMessage(e));\n  // skip or retry depending on cause\n}","preventionTips":["Align database and JVM character encodings","Check date/numeric ranges against column definitions","Batch fetches to limit exposure to mid-stream drops","Log the chained cause to identify the failing column"],"tags":["jdbc","row-extraction","sqlexception"],"backgroundTag":"database-query-failed","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}