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
- Grant the DB user read access to the system catalog/schemas (e.g. SELECT on SYS.ALL_USERS for Oracle).
- Update the JDBC driver to a version that fully supports DatabaseMetaData.getSchemas().
- Check connection liveness before the call and reconnect if stale.
- 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
- Grant catalog/metadata read privileges to the app user
- Use a current JDBC driver that implements getSchemas
- Check connection health before metadata calls
- Log the chained SQLException cause for diagnosis
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
- Unable to get list of procedures from database meta-data:
- Error closing resultset after getting catalogs!
- Error closing resultset after getting schemas!
- Error closing resultset after getting synonyms from schema…
- Error closing resultset after getting views from schema []
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)