pentaho/pentaho-kettle · error · KettleDatabaseException
Unable to obtain last logdate from table " + logtable
Error message
Unable to obtain last logdate from table " + logtable
What it means
Database.getFirstLogDate() executes a query for the maximum log_date of a logging table and wraps any SQLException in a KettleDatabaseException naming the log table. It means the log-date lookup query could not be executed against the given table.
Solutions
- Verify the log table exists and has the expected log_date column in the connected schema
- Check the logging configuration (table name + schema) in your transformation/job log settings
- Run the SQL shown in your DB console to reproduce the driver error
- If the table is intentionally empty/missing, create the logging tables (SQL button in the log table settings)
Example fix
// before
db.getLastLogDate(""KETTLE"."TRANS_LOG"", "transname", "t", "transformation", null);
// after
// confirm table exists, or create it first via logging settings, then:
db.getLastLogDate(""KETTLE"."TRANSMETALOG"", "transname", "t", "transformation", null); Defensive patterns
Strategy: validation
Validate before calling
if (!db.checkTableExistsUnquoted(null, logtable)) {
throw new IllegalStateException("Log table missing: " + logtable + " — create logging tables first");
} Type guard
null
Try / catch
try {
RowMetaAndData last = db.getLastLogDate(logtable, name, id, type, status);
} catch (KettleDatabaseException e) {
log.warn("No last log date for " + logtable + ": " + e.getMessage());
// proceed with default (no previous run)
} Prevention
- Configure logging table names via the Logging tab so names are consistent
- Create logging tables with the built-in SQL generator before first run
- Verify schema/catalog prefixes match the connected user's defaults
- Check permissions to SELECT on logging tables
When it happens
Trigger: Calling getFirstLogDate(schemaTable, ...) / getLastLogDate where the log table name is wrong, the table has no log_date column, or the connection fails during pstmt.executeQuery().
Common situations: Misconfigured logging table names in transformation/job settings, renamed or dropped logging tables, schema prefix mismatch, or connecting to a fresh database with no logging tables created yet.
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
- An error occurred executing SQL:
- Couldn't execute SQL:
- Couldn't find any rows because of an error :
- Couldn't get a result because of an error :
- Couldn't get field info from [" + sql + "]" + Const.CR
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/b6775a4218ac067f.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/database/Database.java:3933
sql += " AND " + databaseMeta.quoteField( "STATUS" ) + " = 'end'";
sql += " AND " + jobtrans + " = ?";
sql +=
" ORDER BY "
+ databaseMeta.quoteField( "LOGDATE" ) + " DESC, " + databaseMeta.quoteField( "ENDDATE" ) + " DESC";
try {
pstmt = connection.prepareStatement( databaseMeta.stripCR( sql ) );
RowMetaInterface r = new RowMeta();
r.addValueMeta( new ValueMetaString( "TRANSNAME", 255, -1 ) );
setValues( r, new Object[] { name } );
try ( ResultSet res = pstmt.executeQuery() ) {
rowMeta = getRowInfo( res.getMetaData(), false, false );
row = getRow( res );
}
} catch ( SQLException ex ) {
throw new KettleDatabaseException( "Unable to obtain last logdate from table " + logtable, ex );
}
return row;
}
public synchronized Long getNextValue( Hashtable<String, Counter> counters, String tableName, String valKey )
throws KettleDatabaseException {
return getNextValue( counters, null, tableName, valKey );
}
public synchronized Long getNextValue( Hashtable<String, Counter> counters, String schemaName, String tableName,
String valKey ) throws KettleDatabaseException {
Long nextValue = null;
String schemaTable = databaseMeta.getQuotedSchemaTableCombination( schemaName, tableName );
String lookup = schemaTable + "." + databaseMeta.quoteField( valKey );
View on GitHub (pinned to f3058517a1)