{"record":{"id":"c913d627b0219677","repo":"apache/seatunnel","slug":"database-null-does-not-exist-in-catalog-null","errorCode":null,"errorMessage":"Database 'null' does not exist in catalog 'null'","messagePattern":"Database 'null' does not exist in catalog 'null'","errorType":"exception","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":406,"sourceCode":"\n    protected String getTableName(ResultSet rs) throws SQLException {\n        String schemaName = rs.getString(1);\n        String tableName = rs.getString(2);\n        if (StringUtils.isNotBlank(schemaName)) {\n            return schemaName + \".\" + tableName;\n        }\n        return null;\n    }\n\n    protected String getTableName(TablePath tablePath) {\n        return tablePath.getSchemaAndTableName();\n    }\n\n    @Override\n    public List<String> listTables(String databaseName)\n            throws CatalogException, DatabaseNotExistException {\n        if (!databaseExists(databaseName)) {\n            throw new DatabaseNotExistException(this.catalogName, databaseName);\n        }\n\n        String dbUrl = getUrlFromDatabaseName(databaseName);\n        try {\n            return queryString(dbUrl, getListTableSql(databaseName), this::getTableName);\n        } catch (Exception e) {\n            throw new CatalogException(\n                    String.format(\"Failed listing database in catalog %s\", catalogName), e);\n        }\n    }\n\n    public List<String> listViews(String databaseName)\n            throws CatalogException, DatabaseNotExistException {\n        if (!databaseExists(databaseName)) {\n            throw new DatabaseNotExistException(this.catalogName, databaseName);\n        }\n        String dbUrl = getUrlFromDatabaseName(databaseName);\n        try {","sourceCodeStart":388,"sourceCodeEnd":424,"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#L388-L424","documentation":"listTables throws DatabaseNotExistException when databaseExists() returns false for the requested databaseName. The message embeds the catalog name and database name (rendered as 'null' here because those arguments were null/unset in this trace). It signals the target database/schema does not exist before any table listing query runs.","triggerScenarios":"Calling listTables(databaseName) with a database name that does not exist in the target JDBC catalog — typically via tableExists() with a misspelled or non-existent database in a TablePath.","commonSituations":"Typos in the database name in the config file; connecting to a different database server than intended (e.g. wrong URL pointing at an empty instance); case-sensitivity mismatch on databases like PostgreSQL where names are lowercased.","solutions":["Verify the database name spelling and case against the actual server (SHOW DATABASES / \\l)","Confirm the catalog URL points at the intended server and instance","Create the database first with catalog.createDatabase() or an admin DDL statement","If probing, call tableExists() with ignore-style handling or catch DatabaseNotExistException and treat as false"],"exampleFix":"// before\ncatalog.listTables(\"MyDB\"); // case mismatch on postgres\n// after\ncatalog.listTables(\"mydb\"); // use exact server-side name","handlingStrategy":"validation","validationCode":"if (!catalog.databaseExists(databaseName)) {\n    throw new IllegalArgumentException(\"database not found: \" + databaseName);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return catalog.listTables(db);\n} catch (DatabaseNotExistException e) {\n    return Collections.emptyList();\n}","preventionTips":["Copy database names from catalog.listDatabases() instead of hardcoding","Watch case sensitivity (Postgres lowercases unquoted identifiers)","Confirm which server/instance the catalog URL targets"],"tags":["jdbc","catalog","database-not-exist"],"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-14T11:17:12.474Z"}