apache/seatunnel · error · CatalogException
Failed dropping database %s in catalog %s
Error message
Failed dropping database %s in catalog %s
What it means
Thrown by AbstractJdbcCatalog.dropDatabaseInternal when executing the dialect-specific DROP DATABASE SQL over the default JDBC URL fails; wraps the SQLException with the database and catalog named in the message.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java:624
if (!databaseExists(tablePath.getDatabaseName())) {
if (ignoreIfNotExists) {
return;
}
throw new DatabaseNotExistException(catalogName, tablePath.getDatabaseName());
}
dropDatabaseInternal(tablePath.getDatabaseName());
}
protected String getDropDatabaseSql(String databaseName) {
throw new UnsupportedOperationException();
}
protected void dropDatabaseInternal(String databaseName) throws CatalogException {
try {
executeInternal(defaultUrl, getDropDatabaseSql(databaseName));
} catch (Exception e) {
throw new CatalogException(
String.format(
"Failed dropping database %s in catalog %s",
databaseName, this.catalogName),
e);
}
}
protected String getUrlFromDatabaseName(String databaseName) {
String url = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/";
return url + databaseName + suffix;
}
protected String getOptionTableName(TablePath tablePath) {
return tablePath.getFullName();
}
@SuppressWarnings("MagicNumber")
protected Map<String, String> buildConnectorOptions(TablePath tablePath) {View on GitHub (pinned to cf67b549a7)
Solutions
- Read the wrapped cause exception for the driver-level reason.
- Grant DROP privileges to the catalog user.
- Disconnect other sessions from the database, or add CASCADE where the dialect supports it (override getDropDatabaseSql).
- Verify defaultUrl targets the correct server and the database exists there.
- Execute the DROP DATABASE statement manually with the same credentials to reproduce.
Example fix
// before
catalog.dropDatabase(TablePath.of("busydb"), false); // fails, sessions active
// after
// override in dialect subclass:
@Override
protected String getDropDatabaseSql(String databaseName) {
return String.format("DROP DATABASE IF EXISTS %s", databaseName);
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!catalog.databaseExists(dbName)) return; // already gone
Try / catch
try { catalog.dropDatabase(path, false); } catch (CatalogException e) { Throwable c = e.getCause(); LOG.error("Drop DB {} failed: {}", dbName, c != null ? c.getMessage() : e.getMessage(), e); } Prevention
- Grant DROP privileges to the catalog user
- Terminate dependent sessions before dropping
- Use CASCADE-capable DDL where the dialect allows
- Test the drop statement manually with the same credentials
When it happens
Trigger: catalog.dropDatabase(tablePath, false) on an existing database where executeInternal(defaultUrl, getDropDatabaseSql(...)) throws: privilege denied, database not empty (dialect requires CASCADE), active connections blocking drop, or connection failure.
Common situations: User lacks DROP privileges on the database; databases with dependent objects on engines requiring CASCADE; other sessions connected to the database (e.g. MySQL/Postgres refusing drop); defaultUrl pointing at the wrong server.
Related errors
- Failed executeSql error %s
- Failed dropping table %s
- Failed creating database %s in catalog %s
- DATABASE_NOT_EXISTED
- Failed truncate table %s in catalog %s
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/8cf0b952e5ed9919.
Report an issue: GitHub.