pentaho/pentaho-kettle · error · KettleDatabaseException

Error getting synonyms from schema []

Error message

Error getting synonyms from schema []

What it means

Thrown when enumerating synonyms via DatabaseMetaData (Oracle-style getTables with SYNONYM type) and a SQLException occurs during iteration/fetch. Kettle wraps it in a KettleDatabaseException naming the schema. Indicates the metadata query for synonyms failed.

Solutions

  1. Only call getSynonyms on databases that support synonyms (mainly Oracle); guard the call by database type (databaseMeta.getDatabaseInterface() instanceof OracleDatabaseMeta).
  2. Fix the schema name case/privileges for Oracle dictionary access.
  3. Inspect the chained SQLException cause for the driver's actual rejection reason.
  4. Pass null schema instead of "" when all schemas are wanted.

Example fix

// before
String[] syns = db.getSynonymMethods(); // fails on PostgreSQL

// after
if (db.getDatabaseMeta().getDatabaseInterface() instanceof OracleDatabaseMeta) {
  String[] syns = db.getSynonymMethods();
}
Defensive patterns

Strategy: validation

Validate before calling

boolean supportsSynonyms = db.getDatabaseMeta().getDatabaseInterface() instanceof OracleDatabaseMeta;
if (!supportsSynonyms) return new String[0];

Type guard

boolean canListSynonyms(DatabaseMeta meta) {
  return meta.getDatabaseInterface() instanceof OracleDatabaseMeta;
}

Try / catch

try {
  synonyms = db.getSynonyms(false, schema);
} catch (KettleDatabaseException e) {
  log.warn("Synonym listing unsupported/failed: " + e.getCause());
  synonyms = new String[0];
}

Prevention

When it happens

Trigger: Database.getSynonyms(...) call where the underlying getTables(catalog, schema, "SYNONYM", null) or its ResultSet.next() throws — typically on non-Oracle databases that don't support synonyms, or with a bad schema argument.

Common situations: Calling getSynonymMethods/getSynonyms on MySQL/PostgreSQL where SYNONYM table type is unsupported; wrong-case schema name on Oracle; user lacks dictionary privileges to list synonyms.

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

Appendix: source

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

          if ( log.isDebug() ) {
            log.logDebug( "Error getting synonyms for field TABLE_SCHEM (ignored): " + e.toString() );
          }
        }

        if ( Utils.isEmpty( schema ) ) {
          schema = cat;
        }

        String table = alltables.getString( TABLES_META_DATA_TABLE_NAME );

        if ( log.isRowLevel() ) {
          log.logRowlevel( toString(), "got synonym from meta-data: "
            + databaseMeta.getQuotedSchemaTableCombination( schema, table ) );
        }
        multimapPut( schema, table, synonymMap );
      }
    } catch ( SQLException e ) {
      throw new KettleDatabaseException( "Error getting synonyms from schema [" + schemaname + "]", e );
    } finally {
      try {
        if ( alltables != null ) {
          alltables.close();
        }
      } catch ( SQLException e ) {
        throw new KettleDatabaseException( "Error closing resultset after getting synonyms from schema ["
          + schemaname + "]", e );
      }
    }

    if ( log.isDetailed() ) {
      log.logDetailed( "read :" + multimapSize( synonymMap ) + " synonyms from db meta-data." );
    }

    return synonymMap;
  }

View on GitHub (pinned to f3058517a1)