pentaho/pentaho-kettle · error · KettleDatabaseException
Error closing resultset after getting catalogs!
Error message
Error closing resultset after getting catalogs!
What it means
Thrown in the finally block of getCatalogs() when the catalog ResultSet cannot be closed after reading catalogs. The listing may have succeeded but cursor cleanup failed, typically due to a broken connection or driver cursor-close failure. Wrapped as KettleDatabaseException.
Solutions
- Reconnect before metadata calls on long-lived Database objects (checkConnection, then disconnect/connect).
- Keep one Database instance per thread.
- Raise idle/network timeouts to survive long jobs.
- Inspect the chained SQLException cause for the driver-level reason.
Example fix
// before
db.getCatalogs(); // stale connection after long idle
// after
if (!db.checkConnection()) { db.disconnect(); db.connect(); }
db.getCatalogs(); Defensive patterns
Strategy: try-catch
Validate before calling
if (!db.checkConnection()) { db.disconnect(); db.connect(); } Try / catch
try {
catalogs = db.getCatalogs();
} catch (KettleDatabaseException e) {
log.warn("Catalog resultset close failed: " + e.getCause());
db.disconnect(); db.connect();
} Prevention
- Reconnect before metadata reads on long-lived connections
- Avoid thread-sharing of Database objects
- Raise idle timeouts to survive long jobs
- Examine the chained SQLException for driver issues
When it happens
Trigger: Database.getCatalogs() where catalogResultSet is non-null but close() throws SQLException — session dropped during/after the metadata query, invalidated cursor, or concurrent connection use.
Common situations: Idle-timeout killing the session between metadata calls; firewall dropping the TCP connection; driver bug closing cursors after prior metadata errors; thread-sharing of a single Database object.
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
- Error closing resultset after getting schemas!
- Error closing resultset after getting synonyms from schema…
- Error closing resultset after getting views from schema []
- Couldn't close query: resultset or prepared statements
- Database.Exception.EmptyConnectionError
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/93bd28209cc461de.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/database/Database.java:4552
public String[] getCatalogs() throws KettleDatabaseException {
ArrayList<String> catalogList = new ArrayList<>();
ResultSet catalogResultSet = null;
try {
catalogResultSet = getDatabaseMetaData().getCatalogs();
// 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 catalogs!", e );
} finally {
try {
if ( catalogResultSet != null ) {
catalogResultSet.close();
}
} catch ( SQLException e ) {
throw new KettleDatabaseException( "Error closing resultset after getting catalogs!", e );
}
}
if ( log.isDetailed() ) {
log.logDetailed( "read :" + catalogList.size() + " catalogs from db meta-data." );
}
return catalogList.toArray( new String[ catalogList.size() ] );
}
public String[] getProcedures() throws KettleDatabaseException {
String sql = databaseMeta.getSQLListOfProcedures();
if ( sql != null ) {
List<Object[]> procs = getRows( sql, 1000 );
String[] str = new String[ procs.size() ];
for ( int i = 0; i < procs.size(); i++ ) {
str[ i ] = procs.get( i )[ 0 ].toString();
}View on GitHub (pinned to f3058517a1)