{"record":{"id":"9537f299c6f301ff","repo":"apache/seatunnel","slug":"the-catalog-is-not-supported-the-getdatabasewi","errorCode":null,"errorMessage":"The catalog: {} is not supported the getDatabaseWithConditionSql for databaseExists","messagePattern":"The catalog: (.+?) is not supported the getDatabaseWithConditionSql for databaseExists","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java","lineNumber":370,"sourceCode":"    public List<String> listDatabases() throws CatalogException {\n        try {\n            return queryString(defaultUrl, getListDatabaseSql(), rs -> rs.getString(1));\n        } catch (Exception e) {\n            throw new CatalogException(\n                    String.format(\"Failed listing database in catalog %s\", this.catalogName), e);\n        }\n    }\n\n    @Override\n    public boolean databaseExists(String databaseName) throws CatalogException {\n        if (StringUtils.isBlank(databaseName)) {\n            return false;\n        }\n        try {\n            return querySQLResultExists(defaultUrl, getDatabaseWithConditionSql(databaseName));\n        } catch (SeaTunnelRuntimeException e) {\n            if (e.getSeaTunnelErrorCode().getCode().equals(UNSUPPORTED_METHOD.getCode())) {\n                log.warn(\n                        \"The catalog: {} is not supported the getDatabaseWithConditionSql for databaseExists\",\n                        this.catalogName);\n                return listDatabases().contains(databaseName);\n            }\n            throw e;\n        } catch (SQLException e) {\n            throw new SeaTunnelException(\"Failed to querySQLResult\", e);\n        }\n    }\n\n    protected String getListTableSql(String databaseName) {\n        throw new UnsupportedOperationException();\n    }\n\n    protected String getTableWithConditionSql(TablePath tablePath) {\n        throw CommonError.unsupportedMethod(this.catalogName, \"getTableWithConditionSql\");\n    }\n","sourceCodeStart":352,"sourceCodeEnd":388,"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#L352-L388","documentation":"AbstractJdbcCatalog.databaseExists normally checks existence via getDatabaseWithConditionSql, but if the concrete JDBC catalog does not implement that method (it throws UNSUPPORTED_METHOD), this warning is logged and the method falls back to listDatabases().contains(databaseName). The result is still correct but slower; the warning tells you the catalog lacks an optimized existence check.","triggerScenarios":"Calling databaseExists (directly or via listTables/listViews/tableExists/createTable/createDatabase/dropDatabase) on a catalog whose getDatabaseWithConditionSql is not implemented — i.e. throws SeaTunnelRuntimeException with UNSUPPORTED_METHOD code.","commonSituations":"Using a less-common JDBC dialect catalog that hasn't implemented the conditional-SQL API; custom catalog subclass overriding only part of AbstractJdbcCatalog; connecting to databases where the catalog name check SQL isn't portable.","solutions":["Implement getDatabaseWithConditionSql in the concrete catalog class to provide dialect-specific existence SQL","Ignore the warning if the fallback via listDatabases() is acceptable (correct but slower)","Upgrade SeaTunnel to a version where your JDBC dialect implements the conditional check","If writing a custom catalog, delegate to an appropriate system query (e.g. SELECT 1 FROM sys.databases WHERE name = ?) for your DB"],"exampleFix":"// before\n@Override\nprotected String getDatabaseWithConditionSql(String databaseName) {\n    throw new SeaTunnelRuntimeException(UNSUPPORTED_METHOD, ...);\n}\n// after\n@Override\nprotected String getDatabaseWithConditionSql(String databaseName) {\n    return \"SELECT schema_name FROM information_schema.schemata WHERE schema_name = '\" + databaseName + \"'\";\n}","handlingStrategy":"fallback","validationCode":"// catalog existence via portable fallback\nboolean dbExists(AbstractJdbcCatalog catalog, String db) {\n    try {\n        return catalog.databaseExists(db);\n    } catch (SeaTunnelRuntimeException e) {\n        return catalog.listDatabases().contains(db);\n    }\n}","typeGuard":null,"tryCatchPattern":"try { catalog.databaseExists(name); }\ncatch (SeaTunnelRuntimeException e) {\n    if (UNSUPPORTED_METHOD.getCode().equals(e.getSeaTunnelErrorCode().getCode())) {\n        return catalog.listDatabases().contains(name); // portable fallback\n    }\n    throw e;\n}","preventionTips":["Implement getDatabaseWithConditionSql in custom JDBC catalogs","Check dialect support before relying on optimized existence checks","Accept the listDatabases() fallback for rare dialects; note the perf cost","Pin a SeaTunnel version where your dialect implements the conditional SQL"],"tags":["jdbc","catalog","unsupported-method","fallback"],"backgroundTag":"unsupported-operation","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}