{"record":{"id":"4a1746231a421a12","repo":"pentaho/pentaho-kettle","slug":"error-evaluating-timestamp-value-metadata","errorCode":null,"errorMessage":"Error evaluating timestamp value metadata","messagePattern":"Error evaluating timestamp value metadata","errorType":"exception","errorClass":"KettleDatabaseException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/value/ValueMetaTimestamp.java","lineNumber":508,"sourceCode":"        int length = rm.getScale( index );\n        ValueMetaInterface valueMeta;\n        if ( databaseMeta.supportsTimestampDataType() ) {\n          valueMeta = new ValueMetaTimestamp( name );\n        } else {\n          valueMeta = new ValueMetaDate( name );\n        }\n        valueMeta.setLength( length );\n\n        // Also get original column details, comment, etc.\n        //\n        getOriginalColumnMetadata( valueMeta, rm, index, ignoreLength );\n\n        return valueMeta;\n      }\n\n      return null;\n    } catch ( Exception e ) {\n      throw new KettleDatabaseException( \"Error evaluating timestamp value metadata\", e );\n    }\n  }\n\n  @Override\n  public Object getValueFromResultSet( DatabaseInterface databaseInterface, ResultSet resultSet, int index )\n    throws KettleDatabaseException {\n\n    try {\n\n      return resultSet.getTimestamp( index + 1 );\n\n    } catch ( Exception e ) {\n      throw new KettleDatabaseException(\n        toStringMeta() + \" : Unable to get timestamp from resultset at index \" + index, e );\n    }\n  }\n\n  @Override","sourceCodeStart":490,"sourceCodeEnd":526,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/value/ValueMetaTimestamp.java#L490-L526","documentation":"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.","triggerScenarios":"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.","commonSituations":"'Get Fields' / SQL preview against exotic databases, drivers that don't implement metadata precision for TIMESTAMP WITH TIME ZONE columns.","solutions":["Inspect the chained cause exception for the real driver error","Reconnect/refresh the database connection before field discovery","Upgrade or replace the JDBC driver","Catch KettleDatabaseException in the discovery code and fall back to a default Timestamp meta"],"exampleFix":"// before\nValueMetaInterface vm = valueMetaTimestamp.getValueFromSQLType(conn, table, field, columns, false);\n// after\ntry {\n  ValueMetaInterface vm = valueMetaTimestamp.getValueFromSQLType(conn, table, field, columns, false);\n} catch (KettleDatabaseException e) {\n  logError(\"Field discovery failed: \" + e.getCause());\n}","handlingStrategy":"try-catch","validationCode":"if (!conn.isValid(5)) throw new IllegalStateException(\"Connection invalid before field discovery\");","typeGuard":null,"tryCatchPattern":"try {\n  valueMeta = vtMeta.getValueFromSQLType(conn, table, field, columns, false);\n} catch (KettleDatabaseException e) {\n  logError(\"Metadata lookup failed, cause=\" + e.getCause());\n  valueMeta = new ValueMetaTimestamp(field.getName()); // default fallback\n}","preventionTips":["Validate the connection before schema discovery","Keep JDBC drivers current","Log getCause() to surface the real driver error","Fall back to a generic timestamp meta instead of failing the whole discovery"],"tags":["pdi","database","jdbc","metadata"],"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"}