{"record":{"id":"26086fb28bed7aef","repo":"apache/seatunnel","slug":"error-to-check-tables","errorCode":null,"errorMessage":"Error to check tables: ","messagePattern":"Error to check tables: ","errorType":"exception","errorClass":"org.apache.seatunnel.api.table.type.SeaTunnelException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/Db2Dialect.java","lineNumber":155,"sourceCode":"    }\n\n    @Override\n    public Db2SourceFetchTaskContext createFetchTaskContext(\n            SourceSplitBase sourceSplitBase, JdbcSourceConfig taskSourceConfig) {\n\n        return new Db2SourceFetchTaskContext((Db2SourceConfig) taskSourceConfig, this);\n    }\n\n    @Override\n    public FetchTask<SourceSplitBase> createFetchTask(SourceSplitBase sourceSplitBase) {\n        if (sourceSplitBase.isSnapshotSplit()) {\n            return new Db2SnapshotFetchTask(sourceSplitBase.asSnapshotSplit());\n        } else {\n            try (JdbcConnection jdbcConnection = openJdbcConnection(sourceConfig)) {\n                List<TableId> tables = sourceSplitBase.asIncrementalSplit().getTableIds();\n                this.checkAllTablesEnabledCapture(jdbcConnection, tables);\n            } catch (SQLException e) {\n                throw new SeaTunnelException(\"Error to check tables: \" + e.getMessage(), e);\n            }\n            return new Db2TransactionLogFetchTask(sourceSplitBase.asIncrementalSplit());\n        }\n    }\n\n    @Override\n    public Optional<PrimaryKey> getPrimaryKey(JdbcConnection jdbcConnection, TableId tableId) {\n        return Optional.ofNullable(\n                tableMap.get(toDb2TableId(tableId)).getTableSchema().getPrimaryKey());\n    }\n\n    @Override\n    public List<ConstraintKey> getConstraintKeys(JdbcConnection jdbcConnection, TableId tableId) {\n        return tableMap.get(toDb2TableId(tableId)).getTableSchema().getConstraintKeys();\n    }\n\n    private static Map<TableId, CatalogTable> createDb2TableMap(List<CatalogTable> catalogTables) {\n        Map<TableId, CatalogTable> tables = new HashMap<>();","sourceCodeStart":137,"sourceCodeEnd":173,"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/Db2Dialect.java#L137-L173","documentation":"createFetchTask() wraps SQLExceptions thrown while opening a JDBC connection and running checkAllTablesEnabledCapture() for an incremental (transaction-log) split into SeaTunnelException(\"Error to check tables: \" + e.getMessage(), e). It means the pre-flight capture-enabling check could not be executed because the JDBC call failed, so the Db2 transaction-log task cannot be created.","triggerScenarios":"createFetchTask() for an incremental split opens openJdbcConnection(sourceConfig) and calls checkAllTablesEnabledCapture(); any SQLException from opening the connection (auth failure, network down, TLS mismatch) or from listOfChangeTables() is wrapped with this message.","commonSituations":"Database went down between snapshot and incremental phase; credentials rotated or expired; firewall/load balancer dropped the idle connection; Db2 capture service unavailable making the metadata query fail; driver URL misconfigured.","solutions":["Inspect e.getCause() for the underlying SQLException message/SQLSTATE to pinpoint the JDBC failure.","Verify the database is reachable and the JDBC URL/credentials in sourceConfig are correct.","Confirm the CDC user retains privileges needed for the capture-metadata query.","If the connection is transiently lost (network blip), restart the job/retry after connectivity is restored — checkpoint recovery should resume the incremental split.","Check Db2 server logs for connection or capture-service errors at the failure time."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Preflight the check with a dedicated connection before creating the task\ntry (JdbcConnection test = openJdbcConnection(sourceConfig)) {\n    test.connect();\n} catch (SQLException e) {\n    throw new IllegalStateException(\"Cannot open DB2 connection for capture check: \" + e.getMessage(), e);\n}","typeGuard":null,"tryCatchPattern":"try {\n    task = dialect.createFetchTask(splitBase);\n} catch (SeaTunnelException e) {\n    if (e.getCause() instanceof SQLException && isTransient((SQLException) e.getCause())) {\n        // retry with backoff; checkpoint recovery resumes the split\n    } else {\n        throw e;\n    }\n}","preventionTips":["Keep DB2 reachable throughout snapshot→streaming transition; monitor connection health.","Use stable credentials that do not expire mid-job.","Enable checkpointing so a failed incremental split can be retried.","Check DB2 server and capture-service logs when the check fails."],"tags":["db2","cdc","jdbc","sql","connection"],"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"}