pentaho/pentaho-kettle · error · KettleDatabaseException

Unable to check if column [" + columnname + "] exists in…

Error message

Unable to check if column [" + columnname + "] exists in table [" + tablename + "] on connection [" + databaseMeta.getName() + "]

What it means

Outer guard of the column existence check: any unexpected Exception while verifying column existence (beyond the metadata/statement handling) is wrapped in this KettleDatabaseException naming the column, table, and connection. It means the check itself blew up, not that the column is missing.

Solutions

  1. Set a name on the DatabaseMeta before use so the message and connection lookup succeed
  2. Ensure the connection is open before calling column existence checks
  3. Inspect the wrapped cause 'e' for the real failure
  4. Validate table/column identifiers before calling to avoid driver-level parse errors

Example fix

// before
DatabaseMeta meta = new DatabaseMeta(); // no name
// after
DatabaseMeta meta = new DatabaseMeta();
meta.setName("prod-db");
Defensive patterns

Strategy: try-catch

Validate before calling

if (dbMeta.getName() == null) {
  dbMeta.setName("unnamed-connection");
}
if (!db.checkConnectionOpen()) db.connect();

Try / catch

try {
  boolean ok = db.columnExists(schema, table, column);
} catch (KettleDatabaseException e) {
  Throwable cause = e.getCause();
  log.error("column check failed on " + dbMeta.getName() + ": " + cause, cause);
}

Prevention

When it happens

Trigger: Any Exception inside checkColumnExists that is not the caught KettleDatabaseException from the statement probe — e.g. databaseMeta.getName() NPE on unnamed metadata, or connection errors during getOneRow.

Common situations: Using a DatabaseMeta with no name set (null getName in message construction), a closed connection during the probe SELECT, or driver-level failures on the test query.

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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/database/Database.java:2362

   */
  @Deprecated
  public boolean checkColumnExists( String columnname, String tablename ) throws KettleDatabaseException {
    try {
      if ( log.isDebug() ) {
        log.logDebug( "Checking if column [" + columnname + "] exists in table [" + tablename + "] !" );
      }

      // Just try to read from the table.
      String sql = databaseMeta.getSQLColumnExists( columnname, tablename );

      try {
        getOneRow( sql );
        return true;
      } catch ( KettleDatabaseException e ) {
        return false;
      }
    } catch ( Exception e ) {
      throw new KettleDatabaseException( "Unable to check if column ["
        + columnname + "] exists in table [" + tablename + "] on connection [" + databaseMeta.getName() + "]", e );
    }
  }

  /**
   * Check whether the sequence exists, Oracle only!
   *
   * @param sequenceName The name of the sequence
   * @return true if the sequence exists.
   */
  public boolean checkSequenceExists( String sequenceName ) throws KettleDatabaseException {
    return checkSequenceExists( null, sequenceName );
  }

  /**
   * Check whether the sequence exists, Oracle only!
   *
   * @param sequenceName The name of the sequence

View on GitHub (pinned to f3058517a1)