{"record":{"id":"9b408bb6310b30c9","repo":"apache/seatunnel","slug":"t-skipping-database-due-to-error-reading-tab-9b408b","errorCode":null,"errorMessage":"\\t skipping database '{}' due to error reading tables: {}","messagePattern":"\\\\t skipping database '(.+?)' due to error reading tables: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-sqlserver/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/sqlserver/utils/TableDiscoveryUtils.java","lineNumber":84,"sourceCode":"                        \"SELECT * FROM [\"\n                                + dbName\n                                + \"].INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE';\",\n                        rs -> {\n                            while (rs.next()) {\n                                TableId tableId =\n                                        new TableId(\n                                                rs.getString(1), rs.getString(2), rs.getString(3));\n                                if (tableFilters.dataCollectionFilter().isIncluded(tableId)) {\n                                    capturedTableIds.add(tableId);\n                                    LOG.info(\"\\t including '{}' for further processing\", tableId);\n                                } else {\n                                    LOG.debug(\"\\t '{}' is filtered out of capturing\", tableId);\n                                }\n                            }\n                        });\n            } catch (SQLException e) {\n                // We were unable to execute the query or process the results, so skip this ...\n                LOG.warn(\n                        \"\\t skipping database '{}' due to error reading tables: {}\",\n                        dbName,\n                        e.getMessage());\n            }\n        }\n        return capturedTableIds;\n    }\n}\n","sourceCodeStart":66,"sourceCodeEnd":93,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-sqlserver/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/sqlserver/utils/TableDiscoveryUtils.java#L66-L93","documentation":"SQL Server TableDiscoveryUtils.listTables() catches SQLException when reading table metadata for a database and logs it at WARN ('\\t skipping database ... due to error reading tables'), skipping that database. The job continues with a possibly incomplete table list, which can silently miss tables you expect to capture.","triggerScenarios":"The metadata query listing tables of a SQL Server database fails with SQLException: login lacks VIEW DEFINITION/SELECT on catalog views, database offline or inaccessible, or transient connection failure during discovery.","commonSituations":"CDC login missing permissions on sys tables of some database; a database in the instance is in restoring/offline state; network instability at job start.","solutions":["Grant the CDC login the needed permissions (VIEW DEFINITION / access to catalog views) on the target databases.","Confirm all configured databases are ONLINE and readable by the CDC user.","Run the table-listing query manually with the CDC login to see the real SQLException.","Check the WARN text for the SQL error and either fix the cause or remove the problematic database from discovery scope."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"-- verify as the CDC login before job start\nSELECT name, state, HAS_DBACCESS(name) AS accessible\nFROM sys.databases;  -- filter for databases you expect to discover","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Grant VIEW DEFINITION / catalog read access to the CDC login on target databases","Confirm all databases in scope are ONLINE (not restoring/offline)","Validate discovery results — a skipped database silently drops tables","Run the metadata query manually with the CDC login to pre-check"],"tags":["cdc","sqlserver","table-discovery","sql","swallowed-exception"],"backgroundTag":"sql-query-failed","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"}