pentaho/pentaho-kettle · error · KettleTransException

Trans.Exception.ErrorInDatabase

Error message

Trans.Exception.ErrorInDatabase

What it means

While evaluating a date-range dependency, Trans opens a separate Database (depdb) and queries it. If that query or connection throws a KettleException, it is wrapped in KettleTransException with Trans.Exception.ErrorInDatabase, naming the dependency's database and the underlying cause. The transformation cannot proceed without computing its dependency date.

Solutions

  1. Read the cause stack trace for the underlying JDBC error
  2. Verify the dependency table/field exist and the user has SELECT rights
  3. Test the dependency connection connectivity before running
  4. Correct the dependency definition in the transformation settings

Example fix

// before: dependency field user cannot read
GRANT SELECT ON staging_log TO public; -- never granted
// after
GRANT SELECT ON staging_log TO kettle_user;
Defensive patterns

Strategy: validation

Validate before calling

for (TransDependency td : transMeta.getDependencies()) {
  if (td.getDatabase() != null) {
    try (java.sql.Connection c = td.getDatabase().getConnection(null)) {
      c.setReadOnly(true);
      try (java.sql.Statement s = c.createStatement()) {
        s.execute("SELECT " + td.getFieldname() + " FROM " + td.getTablename() + " WHERE 1=0");
      }
    }
  }
}

Try / catch

try {
  trans.execute(args);
} catch (KettleTransException e) {
  if (e.getMessage().contains("ErrorInDatabase")) {
    log.error("Dependency DB error: " + e.getCause().getMessage());
    // fix grants/schema or connectivity, then retry
  } else throw e;
}

Prevention

When it happens

Trigger: td.getDatabase() is valid but the depdb connection/query in the dependency loop throws a KettleException (JDBC error, table missing, permissions, network).

Common situations: Dependency table lacks the referenced field (SQL error); insufficient SELECT grants; DB unreachable at init time; driver issues for the dependency connection type.

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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/Trans.java:2406

                    if ( log.isDetailed() ) {
                      log.logDetailed( BaseMessages.getString( PKG, "Trans.Log.FoundDateFromTable", td.getTablename(),
                        "." + td.getFieldname(), " = " + maxvalue.toString() ) );
                    }
                    if ( maxvalue.getTime() > maxdepdate.getTime() ) {
                      maxdepdate = maxvalue;
                    }
                  } else {
                    throw new KettleTransException( BaseMessages.getString( PKG,
                      "Trans.Exception.UnableToGetDependencyInfoFromDB", td.getDatabase().getName() + ".", td
                        .getTablename() + ".", td.getFieldname() ) );
                  }
                } else {
                  throw new KettleTransException( BaseMessages.getString( PKG,
                    "Trans.Exception.UnableToGetDependencyInfoFromDB", td.getDatabase().getName() + ".", td
                      .getTablename() + ".", td.getFieldname() ) );
                }
              } catch ( KettleException e ) {
                throw new KettleTransException( BaseMessages.getString( PKG, "Trans.Exception.ErrorInDatabase", "" + td
                  .getDatabase() ), e );
              } finally {
                depdb.close();
              }
            } else {
              throw new KettleTransException( BaseMessages.getString( PKG, "Trans.Exception.ConnectionCouldNotBeFound",
                "" + td.getDatabase() ) );
            }
            if ( log.isDetailed() ) {
              log.logDetailed( BaseMessages.getString( PKG, "Trans.Log.Maxdepdate" ) + ( XMLHandler.date2string(
                maxdepdate ) ) );
            }
          }

          // OK, so we now have the maximum depdate;
          // If it is larger, it means we have to read everything back in again.
          // Maybe something has changed that we need!
          //

View on GitHub (pinned to f3058517a1)