pentaho/pentaho-kettle · error · KettleDatabaseException

Error evaluating timestamp value metadata

Error message

Error evaluating timestamp value metadata

What it means

A generic wrapper thrown by ValueMetaTimestamp.getValueFromSQLType when any exception occurs while inspecting a java.sql.Types.TIMESTAMP column's metadata to build a matching ValueMeta. The original exception is chained as the cause.

Solutions

  1. Inspect the chained cause exception for the real driver error
  2. Reconnect/refresh the database connection before field discovery
  3. Upgrade or replace the JDBC driver
  4. Catch KettleDatabaseException in the discovery code and fall back to a default Timestamp meta

Example fix

// before
ValueMetaInterface vm = valueMetaTimestamp.getValueFromSQLType(conn, table, field, columns, false);
// after
try {
  ValueMetaInterface vm = valueMetaTimestamp.getValueFromSQLType(conn, table, field, columns, false);
} catch (KettleDatabaseException e) {
  logError("Field discovery failed: " + e.getCause());
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!conn.isValid(5)) throw new IllegalStateException("Connection invalid before field discovery");

Try / catch

try {
  valueMeta = vtMeta.getValueFromSQLType(conn, table, field, columns, false);
} catch (KettleDatabaseException e) {
  logError("Metadata lookup failed, cause=" + e.getCause());
  valueMeta = new ValueMetaTimestamp(field.getName()); // default fallback
}

Prevention

When it happens

Trigger: DatabaseMeta.getValueFromSQLType / table field discovery against a JDBC driver whose ResultSetMetaData methods throw — e.g. closed connection, unsupported/driver-specific timestamp types with precision, or driver bugs on getPrecision/getColumnType.

Common situations: 'Get Fields' / SQL preview against exotic databases, drivers that don't implement metadata precision for TIMESTAMP WITH TIME ZONE columns.

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/4a1746231a421a12. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/row/value/ValueMetaTimestamp.java:508

        int length = rm.getScale( index );
        ValueMetaInterface valueMeta;
        if ( databaseMeta.supportsTimestampDataType() ) {
          valueMeta = new ValueMetaTimestamp( name );
        } else {
          valueMeta = new ValueMetaDate( name );
        }
        valueMeta.setLength( length );

        // Also get original column details, comment, etc.
        //
        getOriginalColumnMetadata( valueMeta, rm, index, ignoreLength );

        return valueMeta;
      }

      return null;
    } catch ( Exception e ) {
      throw new KettleDatabaseException( "Error evaluating timestamp value metadata", e );
    }
  }

  @Override
  public Object getValueFromResultSet( DatabaseInterface databaseInterface, ResultSet resultSet, int index )
    throws KettleDatabaseException {

    try {

      return resultSet.getTimestamp( index + 1 );

    } catch ( Exception e ) {
      throw new KettleDatabaseException(
        toStringMeta() + " : Unable to get timestamp from resultset at index " + index, e );
    }
  }

  @Override

View on GitHub (pinned to f3058517a1)