apache/seatunnel · error · CatalogException
Failed creating database %s in catalog %s
Error message
Failed creating database %s in catalog %s
What it means
Thrown by AbstractJdbcCatalog.createDatabaseInternal when executing the dialect-specific CREATE DATABASE SQL over the default JDBC URL fails; it wraps the SQLException and names the database and catalog involved.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java:569
if (databaseExists(tablePath.getDatabaseName())) {
if (ignoreIfExists) {
return;
}
throw new DatabaseAlreadyExistException(catalogName, tablePath.getDatabaseName());
}
createDatabaseInternal(tablePath.getDatabaseName());
}
protected String getCreateDatabaseSql(String databaseName) {
throw new UnsupportedOperationException();
}
protected void createDatabaseInternal(String databaseName) {
try {
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);
}
}View on GitHub (pinned to cf67b549a7)
Solutions
- Inspect the wrapped cause exception for the driver-level reason.
- Grant CREATE privileges on the server for the catalog user.
- Validate the database name against the DBMS identifier rules.
- Verify defaultUrl connectivity (test with a simple query).
- Create the database manually with a DB client using the same DDL.
Example fix
// before
String name = "my-db"; // hyphen illegal in unquoted MySQL identifier
catalog.createDatabase(TablePath.of(name), false);
// after
catalog.createDatabase(TablePath.of("my_db"), false); Defensive patterns
Strategy: try-catch
Validate before calling
if (!catalog.databaseExists(dbName) && catalog.listDatabases() != null) { /* proceed cautiously */ } Try / catch
try { catalog.createDatabase(path, false); } catch (CatalogException e) { throw new RuntimeException("Create DB " + dbName + " failed: " + e.getCause(), e); } Prevention
- Validate database names against DBMS identifier rules
- Ensure CREATE privilege for the catalog user
- Test defaultUrl connectivity before DDL operations
- Use simple, non-reserved identifiers
When it happens
Trigger: catalog.createDatabase(tablePath, ignoreIfExists=false with non-existent DB) where executeInternal(defaultUrl, getCreateDatabaseSql(...)) throws: permission denied, invalid database name characters, connection failure, or unsupported DDL.
Common situations: User lacks CREATE privileges; database name contains characters illegal for the DBMS; defaultUrl misconfigured so DDL goes to a wrong/unreachable server; dialect-specific keyword conflicts (e.g. reserved names).
Related errors
- Failed executeSql error %s
- Failed dropping table %s
- Failed dropping database %s in catalog %s
- Failed truncate table %s in catalog %s
- Failed to querySQLResult
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/f700ed9cdbf7c3d3.
Report an issue: GitHub.