{"record":{"id":"4aab8bdaa29b367b","repo":"apache/seatunnel","slug":"no-table-has-enabled-cdc-or-security-constraints-p","errorCode":null,"errorMessage":"No table has enabled CDC or security constraints prevent getting the list of change tables","messagePattern":"No table has enabled CDC or security constraints prevent getting the list of change tables","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/reader/fetch/transactionlog/Db2TransactionLogFetchTask.java","lineNumber":420,"sourceCode":"            if (matcher.matches()) {\n                String captureName = matcher.group(1);\n                LOG.info(\"Table is no longer captured with capture instance {}\", captureName);\n                return Arrays.stream(currentChangeTables)\n                        .filter(\n                                changeTable ->\n                                        !changeTable.getCaptureInstance().equals(captureName))\n                        .collect(Collectors.toList())\n                        .toArray(new Db2ChangeTable[0]);\n            }\n            throw exception;\n        }\n\n        private Db2ChangeTable[] getCdcTablesToQuery(\n                Db2Partition partition, Db2OffsetContext offsetContext)\n                throws SQLException, InterruptedException {\n            Set<Db2ChangeTable> cdcEnabledTables = dataConnection.listOfChangeTables();\n            if (cdcEnabledTables.isEmpty()) {\n                LOG.warn(\n                        \"No table has enabled CDC or security constraints prevent getting the list of change tables\");\n            }\n\n            Map<TableId, List<Db2ChangeTable>> includedAndCdcEnabledTables =\n                    cdcEnabledTables.stream()\n                            .filter(\n                                    changeTable ->\n                                            connectorConfig\n                                                    .getTableFilters()\n                                                    .dataCollectionFilter()\n                                                    .isIncluded(changeTable.getSourceTableId()))\n                            .collect(Collectors.groupingBy(Db2ChangeTable::getSourceTableId));\n\n            if (includedAndCdcEnabledTables.isEmpty()) {\n                LOG.warn(DatabaseSchema.NO_CAPTURED_DATA_COLLECTIONS_WARNING);\n            }\n\n            List<Db2ChangeTable> tables = new ArrayList<>();","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/reader/fetch/transactionlog/Db2TransactionLogFetchTask.java#L402-L438","documentation":"Db2TransactionLogFetchTask.getCdcTablesToQuery queries the DB2 CDC staging tables via dataConnection.listOfChangeTables(). When the returned set is empty, it logs this warning meaning either no table in the database has CDC enabled, or the connecting user lacks the privileges needed to see the CDC change tables (sys.cdc.change_tables is permission-filtered). The fetch task then proceeds with no tables to poll, producing an empty stream instead of failing.","triggerScenarios":"Db2TransactionLogFetchTask.getCdcTablesToQuery() (called from tablesSlot/tables) runs at snapshot/stream start and listOfChangeTables() returns an empty set because: (1) no table in the database has 'ALTER TABLE ... ENABLE CDC' (Debezium/SQL Server style CDC capture instance) applied; (2) the SQL Server Agent / CDC capture job is not running so change tables were never materialized; (3) the login lacks VIEW DATABASE STATE / db_owner / sysadmin rights so CDC metadata tables are filtered out.","commonSituations":"Fresh DB2/Db2-z or SQL-Server-compatible CDC environment where administrators forgot to enable CDC on the source tables; connecting with a low-privileged monitoring account instead of the CDC-enabled account; CDC disabled at the database level (is_cdc_enabled = 0) so even enabled-looking tables have no change tables; security hardening revoked access to system CDC catalog views.","solutions":["Enable CDC on the database and on each source table (e.g. EXEC sys.sp_cdc_enable_db then sys.sp_cdc_enable_table for every table the connector should capture) before starting the job","Verify the CDC capture/cleanup jobs are running (capture instance must be active or change tables never appear)","Re-run the connector with an account that has sufficient privileges (db_owner or explicit SELECT on cdc schema and VIEW DATABASE STATE) to see change tables","Check the connector's table include list: if tables are captured but filtered out, review database.include.list / table.include.list config"],"exampleFix":"// before (connector logs warning and streams nothing)\nDb2ChangeTable[] tables = getCdcTablesToQuery(partition, offsetContext); // empty\n// after (DB-side prerequisite, run as admin on the source database)\nEXEC sys.sp_cdc_enable_db;\nEXEC sys.sp_cdc_enable_table @source_schema = N'dbo', @source_name = N'MyTable', @role_name = NULL;","handlingStrategy":"validation","validationCode":"// Before starting the CDC job, verify change tables are visible to the connector user\nint count = runQueryAsConnectorUser(\n    \"SELECT COUNT(*) FROM sys.cdc.change_tables\");\nif (count == 0) {\n    throw new IllegalStateException(\n        \"No CDC change tables visible: enable CDC on tables and/or grant the connector user access to cdc metadata\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enable CDC at the database level and per-table before deploying the connector","Provision the connector's DB account with privileges to read CDC metadata (change tables are security-filtered)","Monitor the source database: alert when the CDC capture job is stopped or when change table count drops to zero","Include a startup smoke test that lists change tables and fails fast when empty"],"tags":["cdc","db2","database","empty-result","permissions"],"backgroundTag":"empty-result-set","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"}