{"record":{"id":"1c61ab3131a76bdb","repo":"apache/seatunnel","slug":"snapshotting-of-table-failed","errorCode":null,"errorMessage":"Snapshotting of table  failed","messagePattern":"Snapshotting of table  failed","errorType":"exception","errorClass":"org.apache.kafka.connect.errors.ConnectException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/reader/fetch/scan/Db2SnapshotSplitReadTask.java","lineNumber":238,"sourceCode":"                            snapshotSplit.splitId(),\n                            Strings.duration(stop - exportStart));\n                    snapshotProgressListener.rowsScanned(\n                            snapshotContext.partition, table.id(), rows);\n                    logTimer = getTableScanLogTimer();\n                }\n                dispatcher.dispatchSnapshotEvent(\n                        snapshotContext.partition,\n                        table.id(),\n                        getChangeRecordEmitter(snapshotContext, table.id(), row),\n                        snapshotReceiver);\n            }\n            log.info(\n                    \"Finished exporting {} records for split '{}', total duration '{}'\",\n                    rows,\n                    snapshotSplit.splitId(),\n                    Strings.duration(clock.currentTimeInMillis() - exportStart));\n        } catch (SQLException e) {\n            throw new ConnectException(\"Snapshotting of table \" + table.id() + \" failed\", e);\n        }\n    }\n\n    protected ChangeRecordEmitter getChangeRecordEmitter(\n            Db2SnapshotContext snapshotContext, TableId tableId, Object[] row) {\n        snapshotContext.offset.event(tableId, clock.currentTime());\n        return new SnapshotChangeRecordEmitter(\n                snapshotContext.partition, snapshotContext.offset, row, clock);\n    }\n\n    private Threads.Timer getTableScanLogTimer() {\n        return Threads.timer(clock, LOG_INTERVAL);\n    }\n\n    private Object readField(ResultSet rs, int columnIndex) throws SQLException {\n        final ResultSetMetaData metaData = rs.getMetaData();\n        final int columnType = metaData.getColumnType(columnIndex);\n","sourceCodeStart":220,"sourceCodeEnd":256,"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/scan/Db2SnapshotSplitReadTask.java#L220-L256","documentation":"During snapshot data export, reading rows from the snapshot JDBC query threw a SQLException, so the task aborts with ConnectException 'Snapshotting of table <tableId> failed'. Note the message may render as 'Snapshotting of table  failed' when table id formatting/interpolation is empty in some code paths.","triggerScenarios":"Executing the snapshot SELECT for a table and receiving a SQLException — connection loss, query timeout, insufficient SELECT privileges, or the table being dropped/altered during the snapshot.","commonSituations":"Long-running snapshots hitting network idle timeouts; DB2 killing long queries; missing read permissions; DBA running maintenance (REORG, table move) during the snapshot.","solutions":["Check the wrapped SQLException in logs for the exact DB2 SQLCODE and fix accordingly","Grant SELECT privileges on the snapshot tables to the CDC user","Avoid DDL/maintenance operations on tables during snapshots","Increase JDBC query/socket timeouts and retry the job"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// preflight: ensure SELECT privilege and connectivity\nSELECT COUNT(*) FROM <table>;","typeGuard":null,"tryCatchPattern":"try { runPipeline(); } catch (ConnectException e) { if (e.getMessage().startsWith(\"Snapshotting of table\")) { fixDb2AccessOrStability(); retry(); } }","preventionTips":["Grant SELECT privileges to the CDC user","Increase JDBC socket/query timeouts","Schedule snapshots outside DB2 maintenance windows"],"tags":["db2","cdc","snapshot","sql"],"backgroundTag":"database-query-failed","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"}