{"record":{"id":"9d2de9de6263f40c","repo":"apache/seatunnel","slug":"failed-connecting-to-s-via-jdbc-9d2de9","errorCode":null,"errorMessage":"Failed connecting to %s via JDBC.","messagePattern":"Failed connecting to (.+?) via JDBC\\.","errorType":"exception","errorClass":"CatalogException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/sink/StarRocksSinkWriter.java","lineNumber":105,"sourceCode":"        this.tableSchema = tableSchemaChangeEventDispatcher.reset(tableSchema).apply(event);\n        SeaTunnelRowType seaTunnelRowType = tableSchema.toPhysicalRowDataType();\n        this.serializer = createSerializer(sinkConfig, seaTunnelRowType);\n        this.manager = new StarRocksSinkManager(sinkConfig, tableSchema);\n\n        try {\n            Class.forName(\"com.mysql.cj.jdbc.Driver\");\n        } catch (ClassNotFoundException e) {\n            throw new RuntimeException(\"Failed to load MySQL JDBC driver\", e);\n        }\n\n        try (Connection conn =\n                DriverManager.getConnection(\n                        sinkConfig.getJdbcUrl(),\n                        sinkConfig.getUsername(),\n                        sinkConfig.getPassword())) {\n            SchemaUtils.applySchemaChange(event, conn, sinkTablePath);\n        } catch (SQLException e) {\n            throw new CatalogException(\n                    String.format(\"Failed connecting to %s via JDBC.\", sinkConfig.getJdbcUrl()), e);\n        }\n    }\n\n    /**\n     * Exposes the resolved StarRocks target table so shared-sink schema changes can be broadcast to\n     * every sibling writer that commits to the same physical table.\n     */\n    @Override\n    public Optional<String> getPhysicalSinkTableIdentifier() {\n        return sinkTablePath == null ? Optional.empty() : Optional.of(sinkTablePath.getFullName());\n    }\n\n    @SneakyThrows\n    @Override\n    public Optional<Void> prepareCommit() {\n        // Flush to storage before snapshot state is performed\n        manager.flush();","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/sink/StarRocksSinkWriter.java#L87-L123","documentation":"After loading the MySQL driver, StarRocksSinkWriter.applySchemaChange opens a JDBC connection to the StarRocks FE using sinkConfig.getJdbcUrl() and calls SchemaUtils.applySchemaChange. Any SQLException from the connect/DDL sequence is wrapped as CatalogException \"Failed connecting to %s via JDBC.\" with the JDBC URL in the message and the SQLException as cause. It indicates the sink could not complete the schema change over the MySQL protocol connection.","triggerScenarios":"DriverManager.getConnection(jdbcUrl, username, password) failing (unreachable FE, wrong port, bad credentials) or SchemaUtils.applySchemaChange throwing SQLException while executing ALTER/DDL against sinkTablePath.","commonSituations":"Wrong jdbc_url host/port for StarRocks FE (query port vs http port confusion); firewall blocking 9030; incorrect username/password or missing database privileges; StarRocks rejecting an ALTER statement (unsupported column change) reported as SQLException.","solutions":["Verify the JDBC URL points at the StarRocks FE MySQL query port (default 9030) and is network-reachable from the SeaTunnel node (test with `mysql -h <host> -P 9030`).","Check username/password and that the account has ALTER privilege on the target database.","Read the cause SQLException in the stack trace for the server-side message (e.g. unsupported schema change) and adjust the schema change event or target table.","Confirm target table/database names in the sink config match an existing StarRocks table."],"exampleFix":"// before\njdbc_url = \"jdbc:mysql://fe-host:8030/db\"\n// after\njdbc_url = \"jdbc:mysql://fe-host:9030/db\"","handlingStrategy":"try-catch","validationCode":"// Pre-flight: check FE connectivity and credentials from the job node\ntry (Connection c = DriverManager.getConnection(\n        \"jdbc:mysql://fe-host:9030/db\", user, pass)) {\n    System.out.println(\"StarRocks FE reachable\");\n} catch (SQLException e) {\n    System.err.println(\"FE unreachable or bad credentials: \" + e.getMessage());\n}","typeGuard":null,"tryCatchPattern":"try {\n    applySchemaChange(event);\n} catch (CatalogException e) {\n    if (e.getMessage().startsWith(\"Failed connecting to\")) {\n        // inspect e.getCause() (SQLException) for server message: connectivity vs rejected DDL\n    }\n}","preventionTips":["Point jdbc_url at the FE MySQL query port (9030), not the HTTP port.","Grant the sink user ALTER privileges on the target database.","Test connectivity with a mysql client from the SeaTunnel worker nodes before running schema-evolution jobs."],"tags":["jdbc","starrocks","connection","schema-change"],"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"}