pentaho/pentaho-kettle · error · KettleDatabaseException

Error getting schemas!

Error message

Error getting schemas!

What it means

Thrown when DatabaseMetaData.getSchemas(...) fails or its ResultSet iteration raises a SQLException. Kettle wraps it as "Error getting schemas!" in a KettleDatabaseException. It means the database refused the schema-listing metadata request.

Solutions

  1. Grant the DB user read access to the system catalog/schemas (e.g. SELECT on SYS.ALL_USERS for Oracle).
  2. Update the JDBC driver to a version that fully supports DatabaseMetaData.getSchemas().
  3. Check connection liveness before the call and reconnect if stale.
  4. Read the chained SQLException (getCause) for the driver's exact error message.

Example fix

// before
String[] schemas = db.getSchemas(); // user lacks catalog privileges

// after
-- grant first: GRANT SELECT ON sys.all_users TO app_user;
String[] schemas = db.getSchemas();
Defensive patterns

Strategy: try-catch

Validate before calling

if (!db.checkConnection()) { db.disconnect(); db.connect(); }
// ensure DB user can query schema catalogs before runtime

Try / catch

try {
  schemas = db.getSchemas();
} catch (KettleDatabaseException e) {
  throw new RuntimeException("Schema listing failed: " + e.getCause(), e);
}

Prevention

When it happens

Trigger: Database.getSchemas() call where databaseMeta.getSchemas(getDatabaseMetaData()) throws while executing or iterating next() — driver rejects getSchemas(), connection broken, or privilege denied on system catalogs.

Common situations: User lacks permission to query system schema catalogs; driver (e.g. older MySQL/Informix) doesn't implement getSchemas properly; connection dropped before the call; JDBC version mismatch between driver and DB server.

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

Appendix: source

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

  private <K, V> int multimapSize( final Map<K, Collection<V>> map ) {
    int count = 0;
    for ( Collection<V> valueCollection : map.values() ) {
      count += valueCollection.size();
    }
    return count;
  }

  public String[] getSchemas() throws KettleDatabaseException {
    ArrayList<String> catalogList = new ArrayList<>();
    ResultSet catalogResultSet = null;
    try {
      catalogResultSet = databaseMeta.getSchemas( getDatabaseMetaData() );
      // Grab all the catalog names and put them in an array list
      while ( catalogResultSet != null && catalogResultSet.next() ) {
        catalogList.add( catalogResultSet.getString( 1 ) );
      }
    } catch ( SQLException e ) {
      throw new KettleDatabaseException( "Error getting schemas!", e );
    } finally {
      try {
        if ( catalogResultSet != null ) {
          catalogResultSet.close();
        }
      } catch ( SQLException e ) {
        throw new KettleDatabaseException( "Error closing resultset after getting schemas!", e );
      }
    }

    if ( log.isDetailed() ) {
      log.logDetailed( "read :" + catalogList.size() + " schemas from db meta-data." );
    }

    return catalogList.toArray( new String[ catalogList.size() ] );
  }

  public String[] getCatalogs() throws KettleDatabaseException {

View on GitHub (pinned to f3058517a1)