apache/seatunnel · error · DatabaseNotExistException
DATABASE_NOT_EXISTED
DATABASE_NOT_EXISTED
Error message
Database %s does not exist in Catalog %s.
What it means
DatabaseNotExistException (code DATABASE_NOT_EXISTED) is thrown by dropDatabase when databaseExists() returns false and ignoreIfNotExists is false. The catalog will not execute the DROP DATABASE DDL for a missing database.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java:611
if (ignoreIfNotExists) {
return;
}
throw new TableNotExistException(catalogName, tablePath);
}
truncateTableInternal(tablePath);
}
@Override
public void dropDatabase(TablePath tablePath, boolean ignoreIfNotExists)
throws DatabaseNotExistException, CatalogException {
checkNotNull(tablePath, "Table path cannot be null");
checkNotNull(tablePath.getDatabaseName(), "Database name cannot be null");
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);
}View on GitHub (pinned to cf67b549a7)
Solutions
- Pass ignoreIfNotExists=true for idempotent teardown.
- Check catalog.databaseExists(name) before dropping.
- Verify the database name spelling and case.
- Confirm the catalog's defaultUrl points at the intended server.
Example fix
// before
catalog.dropDatabase(TablePath.of("staging"), false);
// after
catalog.dropDatabase(TablePath.of("staging"), true); // idempotent teardown Defensive patterns
Strategy: validation
Validate before calling
if (catalog.databaseExists(dbName)) { catalog.dropDatabase(TablePath.of(dbName), false); } Try / catch
try { catalog.dropDatabase(path, false); } catch (DatabaseNotExistException e) { LOG.info("Database {} already absent; nothing to drop", dbName); } Prevention
- Use ignoreIfNotExists=true in teardown scripts
- Check databaseExists before dropping
- Verify server/environment the catalog points to
- Keep database name case consistent across environments
When it happens
Trigger: Calling catalog.dropDatabase(tablePath, false) where the database name is absent from the catalog: never created, already dropped, wrong environment, or name case mismatch.
Common situations: Tear-down scripts running against the wrong environment; database already removed in a previous run; identifier case mismatch (e.g. uppercase vs lowercase); catalog pointed at a different server than expected.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Failed dropping database %s in catalog %s
- CONNECT_FAILED
- Failed executeSql error %s
- Failed connecting to the configured JDBC URL via JDBC.
- Table 'TablePath{databaseName='null', schemaName='null', tab
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/c494e188b8c538b7.
Report an issue: GitHub.