{"record":{"id":"12b4a6536ba3e112","repo":"apache/seatunnel","slug":"failed-to-read-schema-for-table-s-12b4a6","errorCode":null,"errorMessage":"Failed to read schema for table %s ","messagePattern":"Failed to read schema for table (.+?) ","errorType":"exception","errorClass":"SeaTunnelException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-sqlserver/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/sqlserver/utils/SqlServerSchema.java","lineNumber":83,"sourceCode":"                    tables,\n                    tableId.catalog(),\n                    tableId.schema(),\n                    connectorConfig.getTableFilters().dataCollectionFilter(),\n                    null,\n                    false);\n            for (TableId id : tables.tableIds()) {\n                if (tableMap.containsKey(id)) {\n                    Table table =\n                            CatalogTableUtils.mergeCatalogTableConfig(\n                                    tables.forTable(id), tableMap.get(id));\n                    TableChanges.TableChange tableChange =\n                            new TableChanges.TableChange(\n                                    TableChanges.TableChangeType.CREATE, table);\n                    schemasByTableId.put(id, tableChange);\n                }\n            }\n        } catch (SQLException e) {\n            throw new SeaTunnelException(\n                    String.format(\"Failed to read schema for table %s \", tableId), e);\n        }\n\n        if (!schemasByTableId.containsKey(tableId)) {\n            throw new SeaTunnelException(\n                    String.format(\"Can't obtain schema for table %s \", tableId));\n        }\n\n        return schemasByTableId.get(tableId);\n    }\n}\n","sourceCodeStart":65,"sourceCodeEnd":95,"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/SqlServerSchema.java#L65-L95","documentation":"SqlServerSchema.readTableSchema reads the schema of a table from SQL Server metadata; if the JDBC metadata query throws SQLException it wraps it in a SeaTunnelException. This happens while getTableSchema resolves column types for a captured table.","triggerScenarios":"SQLException from the metadata query in readTableSchema (called by getTableSchema) — e.g. connection failure or invalid table identifier passed to the schema lookup.","commonSituations":"Database unreachable or credentials wrong; table dropped before schema read; special characters in schema/table names not escaped; firewall blocking the connection during startup.","solutions":["Confirm the database connection parameters (host, port, user, password) are correct and the server is reachable","Verify the table identifier exists and is accessible with the configured credentials","Check the nested SQLException for the exact JDBC error code and address it (network, auth, naming)","Retry; transient network glitches during startup commonly cause this"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-flight: verify metadata is readable\ntry (Connection c = DriverManager.getConnection(url, user, pass)) {\n    DatabaseMetaData md = c.getMetaData();\n    try (ResultSet rs = md.getColumns(null, \"dbo\", \"Orders\", null)) {\n        if (!rs.next()) throw new IllegalStateException(\"No schema visible for table\");\n    }\n}","typeGuard":null,"tryCatchPattern":"// Job-level retry for transient metadata read failures\ntry {\n    startJob(cfg);\n} catch (SeaTunnelException e) {\n    if (e.getMessage().startsWith(\"Failed to read schema\")) {\n        retryWithBackoff(() -> startJob(cfg), 3);\n    } else throw e;\n}","preventionTips":["Test DB connectivity and credentials before starting the job","Avoid dropping/renaming tables between config and job start","Escape special characters in schema/table names consistently","Check the nested SQLException for precise JDBC error"],"tags":["cdc","sqlserver","schema","metadata"],"backgroundTag":"schema-validation-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"}