pentaho/pentaho-kettle · error · KettleDatabaseException

Unable to get value '" + val.toStringMeta() + "' from…

Error message

Unable to get value '" + val.toStringMeta() + "' from database resultset, index " + i

What it means

NeoviewDatabaseMeta.getValueFromResultSet throws this KettleDatabaseException when a SQLException occurs while converting a result set column into a Kettle Value. The message names the value's metadata representation (val.toStringMeta()) and the 0-based index, with the SQLException chained as cause.

Solutions

  1. Check the chained SQLException for the true driver error (invalid index vs type mismatch)
  2. Ensure the ValueMeta type matches the actual column type returned by the query
  3. Validate index is within the result set's column count and the connection stayed alive during row iteration

Example fix

// before
int idx = i - 1; // wrong off-by-one for 1-based JDBC
Object v = getValueFromResultSet(rs, val, idx);
// after
Object v = getValueFromResultSet(rs, val, i); // 0-based index expected by this API, computed from the actual row metadata
Defensive patterns

Strategy: try-catch

Validate before calling

if (i < 0 || i >= rowMeta.size()) throw new IllegalArgumentException("Value index " + i + " outside row layout of size " + rowMeta.size());

Type guard

function canReadValue(ResultSet rs, int index) { try { return rs != null && index >= 1 && index <= rs.getMetaData().getColumnCount(); } catch (SQLException e) { return false; } }

Try / catch

try {
  Object data = neoviewMeta.getValueFromResultSet(rs, val, i);
} catch (KettleDatabaseException e) {
  SQLException sql = (SQLException) e.getCause(); // inspect driver error: bad index vs type mismatch
  log.error("Could not read value " + val.toStringMeta() + " at index " + i + ": " + (sql != null ? sql.getMessage() : e.getMessage()), e);
}

Prevention

When it happens

Trigger: Calling rs.getXXX(...) for the value's type on a Neoview result set and the driver raises SQLException — bad index, type mismatch between declared and requested type, or connection loss mid-read.

Common situations: Row-reading loops during table input/preview steps; schema changed so a column's type no longer matches the ValueMeta; index computed off a stale row layout.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/database/NeoviewDatabaseMeta.java:457

            // Neoview can not handle getDate / getTimestamp for a Time column
            data = rs.getTime( i + 1 );
            break; // Time is a subclass of java.util.Date, the default date
                   // will be 1970-01-01
          } else if ( val.getPrecision() != 1 && supportsTimeStampToDateConversion() ) {
            data = rs.getTimestamp( i + 1 );
            break; // Timestamp extends java.util.Date
          } else {
            data = rs.getDate( i + 1 );
            break;
          }
        default:
          break;
      }
      if ( rs.wasNull() ) {
        data = null;
      }
    } catch ( SQLException e ) {
      throw new KettleDatabaseException( "Unable to get value '"
        + val.toStringMeta() + "' from database resultset, index " + i, e );
    }

    return data;
  }

}

View on GitHub (pinned to f3058517a1)