apache/seatunnel · warning · CatalogException
Failed to close %s via JDBC.
Error message
Failed to close %s via JDBC.
What it means
CatalogException thrown by closeDatabaseConnection when Connection.close() raises a SQLException. This happens during catalog shutdown/cleanup when releasing the cached connection for a given database URL.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java:585
executeInternal(defaultUrl, getCreateDatabaseSql(databaseName));
} catch (Exception e) {
throw new CatalogException(
String.format(
"Failed creating database %s in catalog %s",
databaseName, this.catalogName),
e);
}
}
protected void closeDatabaseConnection(String databaseName) {
String dbUrl = getUrlFromDatabaseName(databaseName);
try {
Connection connection = connectionMap.remove(dbUrl);
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
throw new CatalogException(String.format("Failed to close %s via JDBC.", dbUrl), e);
}
}
public void truncateTable(TablePath tablePath, boolean ignoreIfNotExists)
throws TableNotExistException, CatalogException {
checkNotNull(tablePath, "Table path cannot be null");
if (!tableExists(tablePath)) {
if (ignoreIfNotExists) {
return;
}
throw new TableNotExistException(catalogName, tablePath);
}
truncateTableInternal(tablePath);
}
@Override
public void dropDatabase(TablePath tablePath, boolean ignoreIfNotExists)
throws DatabaseNotExistException, CatalogException {View on GitHub (pinned to cf67b549a7)
Solutions
- Inspect the wrapped SQLException; in most cases the connection is dead and can be safely discarded.
- Retry close once; if it still fails, remove the connection from the pool and continue shutdown.
- Enable connection keep-alive/validation queries to avoid stale connections.
- Upgrade the JDBC driver if close() errors are a known issue for your version.
- Treat as non-fatal during cleanup if all real work already completed.
Example fix
// before
catalog.close(); // throws on stale connection
// after
try {
catalog.close();
} catch (CatalogException e) {
LOG.warn("Ignoring error closing catalog connection: {}", e.getMessage());
} Defensive patterns
Strategy: try-catch
Try / catch
try { catalog.close(); } catch (CatalogException e) { LOG.warn("Failed closing JDBC catalog connection (ignored): {}", e.getMessage()); } Prevention
- Treat close failures during cleanup as non-fatal
- Enable keep-alive/validation queries to reduce stale connections
- Keep JDBC drivers up to date
- Close catalogs promptly after work completes
When it happens
Trigger: Calling catalog.close() (or internal closeDatabaseConnection) when the cached JDBC connection for dbUrl is already broken/aborted by the server, network was dropped, or the driver reports an error on close.
Common situations: Long-running job where the DB server reaped idle connections; firewall/NAT dropped the TCP session; driver bug or connection pool mismanagement; catalog closed after a prior connectivity failure.
Related errors
- Failed to finish the JDBC source read transaction. Closing t
- Failed to close the JDBC source connection after transaction
- WRITER_OPERATION_FAILED
- JDBC connection close failed.
- CLOSE_CONNECTION_FAILED
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/b41d61247f1bd3da.
Report an issue: GitHub.