{"record":{"id":"9fd04097c4f5350e","repo":"risingwavelabs/risingwave","slug":"missing-port-in-jdbc-url","errorCode":null,"errorMessage":"missing port in jdbc url","messagePattern":"missing port in jdbc url","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/stream/src/from_proto/sink.rs","lineNumber":407,"sourceCode":"        bail!(\n            \"invalid jdbc url, to switch to postgres rust connector, we need to use the url jdbc:postgresql://...\"\n        )\n    }\n\n    // trim the \"jdbc:\" prefix to make it a valid url\n    let url = url.replace(\"jdbc:\", \"\");\n\n    // parse the url\n    let url = Url::parse(&url).map_err(|e| anyhow!(e).context(\"failed to parse jdbc url\"))?;\n\n    let scheme = url.scheme();\n    assert_eq!(\"postgresql\", scheme, \"jdbc scheme should be postgresql\");\n    let host = url\n        .host_str()\n        .ok_or_else(|| anyhow!(\"missing host in jdbc url\"))?;\n    let port = url\n        .port()\n        .ok_or_else(|| anyhow!(\"missing port in jdbc url\"))?;\n    let Some(db_name) = url.path().strip_prefix('/') else {\n        bail!(\"missing db_name in jdbc url\");\n    };\n    let mut username = None;\n    let mut password = None;\n    for (key, value) in url.query_pairs() {\n        if key == \"user\" {\n            username = Some(value.to_string());\n        }\n        if key == \"password\" {\n            password = Some(value.to_string());\n        }\n    }\n\n    Ok(JdbcUrl {\n        host: host.to_owned(),\n        port,\n        db_name: db_name.to_owned(),","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/stream/src/from_proto/sink.rs#L389-L425","documentation":"`parse_jdbc_url` requires an explicit TCP port and bails with 'missing port in jdbc url' when `Url::port()` returns `None` (i.e. no `:port` in the URL). Unlike JDBC drivers, this connector does not default to 5432.","triggerScenarios":"Creating a JDBC sink with `jdbc:postgresql://host/db` — a host without a `:port` suffix — when the sink executor is built.","commonSituations":"Users omitting the port assuming the postgres default 5432 is applied, as many JDBC clients do; URLs copied from docs that show portless forms.","solutions":["Add the port explicitly: `jdbc:postgresql://host:5432/db`.","Use 5432 unless the postgres server listens on a custom port.","Verify the URL after editing — every part (host, port, dbname) must be present.","Recreate the sink with the corrected `jdbc.url`."],"exampleFix":"// before\njdbc.url = 'jdbc:postgresql://pg.example.com/mydb'\n// after\njdbc.url = 'jdbc:postgresql://pg.example.com:5432/mydb'","handlingStrategy":"validation","validationCode":"let stripped = jdbc_url.strip_prefix(\"jdbc:\").unwrap();\nassert!(url::Url::parse(stripped).ok().map(|u| u.port().is_some()).unwrap_or(false), \"jdbc url must contain explicit port\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always append :5432 (or the server's port) — no implicit default is applied here.","Copy URLs from working examples that include the port.","Document your postgres port in team config templates."],"tags":["jdbc","url-parsing","missing-port","sink"],"backgroundTag":"invalid-url-format","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}