{"record":{"id":"dd87f76fa8dcbce5","repo":"apache/beam","slug":"invalid-jdbc-url-format-expected-jdbc-clickhouse-or-jdbc-ch","errorCode":null,"errorMessage":"Invalid JDBC URL format. Expected 'jdbc:clickhouse:' or 'jdbc:ch:' prefix. Got: ","messagePattern":"Invalid JDBC URL format\\. Expected 'jdbc:clickhouse:' or 'jdbc:ch:' prefix\\. Got: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/clickhouse/src/main/java/org/apache/beam/sdk/io/clickhouse/ClickHouseJdbcUrlParser.java","lineNumber":140,"sourceCode":"   * @param jdbcUrl the JDBC URL to process\n   * @return normalized HTTP/HTTPS URL\n   * @throws IllegalArgumentException if the URL format is invalid\n   */\n  private static String extractHttpUrl(String jdbcUrl) {\n    // Remove jdbc: prefix\n    String urlWithoutJdbc = jdbcUrl;\n    if (jdbcUrl.toLowerCase().startsWith(\"jdbc:\")) {\n      urlWithoutJdbc = jdbcUrl.substring(5);\n    }\n\n    // Handle jdbc:clickhouse: or jdbc:ch: prefix\n    String actualUrl;\n    if (urlWithoutJdbc.toLowerCase().startsWith(\"clickhouse:\")) {\n      actualUrl = urlWithoutJdbc.substring(11);\n    } else if (urlWithoutJdbc.toLowerCase().startsWith(\"ch:\")) {\n      actualUrl = urlWithoutJdbc.substring(3);\n    } else {\n      throw new IllegalArgumentException(\n          \"Invalid JDBC URL format. Expected 'jdbc:clickhouse:' or 'jdbc:ch:' prefix. Got: \"\n              + jdbcUrl);\n    }\n\n    boolean useHttps = false;\n\n    // Check if port suggests HTTPS (8443 is default HTTPS port for ClickHouse)\n    if (actualUrl.contains(\":8443\")) {\n      useHttps = true;\n    }\n\n    // Check if ssl=true in query string\n    if (actualUrl.toLowerCase().contains(\"ssl=true\")) {\n      useHttps = true;\n    }\n\n    // Check for invalid schemes before prepending http://\n    if (actualUrl.contains(\"://\")) {","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/clickhouse/src/main/java/org/apache/beam/sdk/io/clickhouse/ClickHouseJdbcUrlParser.java#L122-L158","documentation":"Thrown by ClickHouseJdbcUrlParser.extractHttpUrl when the part after the leading 'jdbc:' does not start (case-insensitively) with the 'clickhouse:' or 'ch:' vendor prefix. The parser only recognizes these two prefixes so downstream handling operates on a known URL shape.","triggerScenarios":"Calling parse() with a URL missing the vendor prefix (e.g. 'http://host:8123'), using another database's URL (jdbc:mysql://...), an alias like 'jdbc:clickhouse+http:', or a typo such as 'jdbc:ClickHose:'.","commonSituations":"Reusing a JDBC URL written for a different driver in a ClickHouse pipeline; hand-editing the prefix; migrating between older ClickHouse JDBC drivers that used different URL conventions.","solutions":["Prefix the URL with 'jdbc:clickhouse:' or the shorter 'jdbc:ch:' before parsing.","Confirm the input is not a URL for another database system.","Check the prefix spelling; comparison is case-insensitive but must match exactly.","Update configuration when migrating from older ClickHouse JDBC driver URL formats."],"exampleFix":"// before\nString url = \"http://localhost:8123/default\"; // missing prefixes\n// after\nString url = \"jdbc:clickhouse:http://localhost:8123/default\";","handlingStrategy":"validation","validationCode":"boolean hasClickHousePrefix(String url) {\n  if (url == null) return false;\n  String lower = url.toLowerCase();\n  return lower.startsWith(\"jdbc:clickhouse:\") || lower.startsWith(\"jdbc:ch:\");\n}","typeGuard":null,"tryCatchPattern":"if (!hasClickHousePrefix(jdbcUrl)) {\n  throw new ConfigException(\"URL must start with jdbc:clickhouse: or jdbc:ch:, got: \" + jdbcUrl);\n}\nParsedJdbcUrl parsed = ClickHouseJdbcUrlParser.parse(jdbcUrl);","preventionTips":["Centralize JDBC URL construction so the vendor prefix is added in one place.","Use constants like JDBC_PREFIX = \"jdbc:clickhouse:\" instead of hand-typed strings.","When migrating drivers, grep configs for old prefixes and update them.","Prefix spelling must match exactly ('clickhouse' or 'ch'); case is handled."],"tags":["jdbc","clickhouse","url-parsing","configuration"],"backgroundTag":"invalid-url-format","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}