{"record":{"id":"25fbcdd89c8f51f7","repo":"apache/seatunnel","slug":"connect-failed-25fbcd","errorCode":"CONNECT_FAILED","errorMessage":"Failed to open Databend source reader: ${e.getMessage()}","messagePattern":"Failed to open Databend source reader: (.+?)","errorType":"error_code","errorClass":"DatabendConnectorException","httpStatus":null,"severity":"critical","filePath":"seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/source/DatabendSourceReader.java","lineNumber":119,"sourceCode":"            // if rowType is null or empty, infer it from ResultSet metadata\n            if (rowType == null || rowType.getFieldNames().length == 0) {\n                log.info(\"Row type is null or empty, inferring from ResultSet metadata\");\n                rowType = inferRowTypeFromResultSet(resultSet.getMetaData());\n                log.info(\"Inferred row type: {}\", rowType);\n            } else {\n                log.info(\"Using provided row type: {}\", rowType);\n            }\n\n            hasNext = resultSet.next();\n            log.info(\"Initial resultSet.next() returned: {}\", hasNext);\n            if (!hasNext) {\n                log.info(\"No data found in result set\");\n                reachEnd = true;\n            }\n\n        } catch (Exception e) {\n            log.error(\"Error while opening Databend source reader\", e);\n            throw new DatabendConnectorException(\n                    DatabendConnectorErrorCode.CONNECT_FAILED,\n                    \"Failed to open Databend source reader: \" + e.getMessage(),\n                    e);\n        }\n        log.info(\"DatabendSourceReader opened successfully\");\n    }\n\n    public SeaTunnelRowType getRowType() {\n        return this.rowType;\n    }\n\n    @Override\n    public void internalPollNext(Collector<SeaTunnelRow> output) throws Exception {\n        if (reachEnd) {\n            return;\n        }\n\n        log.info(\"Starting to poll data from Databend\");","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/source/DatabendSourceReader.java#L101-L137","documentation":"DatabendSourceReader.open() establishes the JDBC connection, runs the configured query (or initial type-check query), and positions the reader. Any exception during this startup — connection failure, bad credentials, invalid SQL — is wrapped in DatabendConnectorException(CONNECT_FAILED) with the original message. The reader cannot start and the source task fails.","triggerScenarios":"open() executes DriverManager/connection setup or the initial query and any Exception occurs: unknown host, refused connection, auth failure, database/table not found, or invalid SQL from the sql/query option.","commonSituations":"Databend server not running or wrong host/port in the JDBC URL; wrong username/password; query references a non-existent table; network/firewall blocking the driver port; SQL syntax error in a custom query.","solutions":["Verify the JDBC URL host, port, and that Databend is reachable (test with a client or ping/telnet).","Check username/password and that the account can access the target database.","Run the configured sql/query directly against Databend to catch SQL or missing-table errors.","Read the chained 'Caused by' for the precise driver-level failure.","Increase connection timeouts if the network is slow/unreliable."],"exampleFix":"// before: wrong port, connection refused\nurl = \"jdbc:databend://localhost:8123\"\n// after: correct Databend query port\nurl = \"jdbc:databend://localhost:8000\"","handlingStrategy":"retry","validationCode":"// preflight connectivity before launching the job\ntry (Connection c = DriverManager.getConnection(jdbcUrl, user, pass)) {\n    try (Statement s = c.createStatement();\n         ResultSet rs = s.executeQuery(\"SELECT 1\")) {\n        rs.next();\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    // run the job\n} catch (DatabendConnectorException e) {\n    if (e.getMessage().startsWith(\"Failed to open Databend source reader:\")) {\n        // backoff and retry; check e.getCause() for auth vs network vs SQL error\n    } else throw e;\n}","preventionTips":["Test the JDBC URL and credentials with a standalone client first","Run the configured sql/query manually to catch SQL/table errors","Confirm network/firewall allows the Databend port from the cluster","Set explicit connection timeouts so failures surface quickly"],"tags":["databend","source","connection","startup"],"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-14T11:17:12.474Z"}