{"record":{"id":"c494e188b8c538b7","repo":"apache/seatunnel","slug":"database-not-existed","errorCode":"DATABASE_NOT_EXISTED","errorMessage":"Database %s does not exist in Catalog %s.","messagePattern":"Database (.+?) does not exist in Catalog (.+?)\\.","errorType":"error_code","errorClass":"DatabaseNotExistException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java","lineNumber":611,"sourceCode":"            if (ignoreIfNotExists) {\n                return;\n            }\n            throw new TableNotExistException(catalogName, tablePath);\n        }\n        truncateTableInternal(tablePath);\n    }\n\n    @Override\n    public void dropDatabase(TablePath tablePath, boolean ignoreIfNotExists)\n            throws DatabaseNotExistException, CatalogException {\n        checkNotNull(tablePath, \"Table path cannot be null\");\n        checkNotNull(tablePath.getDatabaseName(), \"Database name cannot be null\");\n\n        if (!databaseExists(tablePath.getDatabaseName())) {\n            if (ignoreIfNotExists) {\n                return;\n            }\n            throw new DatabaseNotExistException(catalogName, tablePath.getDatabaseName());\n        }\n        dropDatabaseInternal(tablePath.getDatabaseName());\n    }\n\n    protected String getDropDatabaseSql(String databaseName) {\n        throw new UnsupportedOperationException();\n    }\n\n    protected void dropDatabaseInternal(String databaseName) throws CatalogException {\n        try {\n            executeInternal(defaultUrl, getDropDatabaseSql(databaseName));\n        } catch (Exception e) {\n            throw new CatalogException(\n                    String.format(\n                            \"Failed dropping database %s in catalog %s\",\n                            databaseName, this.catalogName),\n                    e);\n        }","sourceCodeStart":593,"sourceCodeEnd":629,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java#L593-L629","documentation":"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.","triggerScenarios":"Calling catalog.dropDatabase(tablePath, false) where the database name is absent from the catalog: never created, already dropped, wrong environment, or name case mismatch.","commonSituations":"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.","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."],"exampleFix":"// before\ncatalog.dropDatabase(TablePath.of(\"staging\"), false);\n// after\ncatalog.dropDatabase(TablePath.of(\"staging\"), true); // idempotent teardown","handlingStrategy":"validation","validationCode":"if (catalog.databaseExists(dbName)) { catalog.dropDatabase(TablePath.of(dbName), false); }","typeGuard":null,"tryCatchPattern":"try { catalog.dropDatabase(path, false); } catch (DatabaseNotExistException e) { LOG.info(\"Database {} already absent; nothing to drop\", dbName); }","preventionTips":["Use ignoreIfNotExists=true in teardown scripts","Check databaseExists before dropping","Verify server/environment the catalog points to","Keep database name case consistent across environments"],"tags":["jdbc","catalog","database-not-found","drop-database"],"backgroundTag":"resource-not-found","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}