apache/seatunnel · error · DatabaseNotExistException
DATABASE_NOT_EXISTED
DATABASE_NOT_EXISTED
Error message
Database %s does not exist in Catalog %s.
What it means
DamengCatalog.listTables first verifies the database (schema) exists; if not, it throws DatabaseNotExistException (a typed CatalogException with code DATABASE_NOT_EXISTED) with message 'Database <db> does not exist in Catalog <catalog>'. This is a precondition check before querying ALL_TABLES.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/dm/DamengCatalog.java:202
.build();
return DmdbTypeConverter.INSTANCE.convert(typeDefine);
}
@Override
protected String getUrlFromDatabaseName(String databaseName) {
return defaultUrl;
}
@Override
protected String getOptionTableName(TablePath tablePath) {
return tablePath.getSchemaAndTableName();
}
@Override
public List<String> listTables(String databaseName)
throws CatalogException, DatabaseNotExistException {
if (!databaseExists(databaseName)) {
throw new DatabaseNotExistException(this.catalogName, databaseName);
}
try (PreparedStatement ps =
getConnection(defaultUrl)
.prepareStatement("SELECT OWNER, TABLE_NAME FROM ALL_TABLES");
ResultSet rs = ps.executeQuery()) {
List<String> tables = new ArrayList<>();
while (rs.next()) {
tables.add(rs.getString(1) + "." + rs.getString(2));
}
return tables;
} catch (Exception e) {
throw new CatalogException(
String.format("Failed listing table in catalog %s", catalogName), e);
}
}View on GitHub (pinned to cf67b549a7)
Solutions
- Create the schema in Dameng before calling listTables (or before running the job)
- Match identifier casing exactly (check what SHOW/SELECT returns from Dameng; quoted names are case-sensitive)
- Verify the connection/defaultUrl points to the intended Dameng instance
- Catch DatabaseNotExistException and create the schema or fail fast with a clear message
Example fix
// before
List<String> tables = catalog.listTables("MySchema"); // DatabaseNotExistException
// after
String schema = catalog.listDatabases().stream()
.filter(d -> d.equalsIgnoreCase("MySchema"))
.findFirst()
.orElseThrow(() -> new IllegalStateException("Create schema in Dameng first"));
List<String> tables = catalog.listTables(schema); Defensive patterns
Strategy: validation
Validate before calling
// Java
boolean exists = catalog.listDatabases().stream()
.anyMatch(d -> d.equals(databaseName)); // exact-case match
if (!exists) { throw new IllegalStateException("Schema missing in Dameng: " + databaseName); } Try / catch
// Java
try {
return catalog.listTables(databaseName);
} catch (DatabaseNotExistException e) {
LOG.error("Schema {} does not exist in {}; create it first", databaseName, e.getCatalogName());
throw e;
} Prevention
- Create the schema in Dameng before listing tables or running jobs
- Use exact identifier casing — quoted Dameng identifiers are case-sensitive
- Confirm the JDBC URL points at the intended instance before debugging 'not exist' errors
When it happens
Trigger: Calling listTables(databaseName) with a databaseName that does not match any existing Dameng schema, including wrong-case names (Dameng identifiers are case-sensitive when quoted) or the default schema not being initialized.
Common situations: Configuring schema/database names with wrong casing; pointing the catalog at a fresh Dameng instance where the schema was never created; confusing database vs schema concepts in Dameng.
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
- Database 'null' does not exist in catalog 'null'
- Failed listing table in catalog %s
- Unsupported constraint type:
- Error executing DDL SQL:
- CONFIG_VALIDATION_FAILED
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/d0b237c1c6d37489.
Report an issue: GitHub.