From 9aca6cc5170533ac9f312b97c8d1a3680eaec45e Mon Sep 17 00:00:00 2001 From: Noel Kwan Date: Wed, 11 Dec 2024 08:58:09 +0800 Subject: [PATCH] docs --- src/stream/src/from_proto/sink.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/stream/src/from_proto/sink.rs b/src/stream/src/from_proto/sink.rs index 2a5da8d88df73..3888008f3a002 100644 --- a/src/stream/src/from_proto/sink.rs +++ b/src/stream/src/from_proto/sink.rs @@ -336,8 +336,12 @@ fn parse_jdbc_url(url: &str) -> anyhow::Result { bail!("invalid jdbc url, to switch to postgres rust connector, we need to use the url jdbc:postgresql://...") } + // trim the "jdbc:" prefix to make it a valid url let url = url.replace("jdbc:", ""); + + // parse the url let url = Url::parse(&url).map_err(|e| anyhow!(e).context("failed to parse jdbc url"))?; + let scheme = url.scheme(); assert_eq!("postgresql", scheme, "jdbc scheme should be postgresql"); let host = url @@ -359,6 +363,7 @@ fn parse_jdbc_url(url: &str) -> anyhow::Result { } let username = username.ok_or_else(|| anyhow!("missing username in jdbc url"))?; let password = password.ok_or_else(|| anyhow!("missing password in jdbc url"))?; + Ok(JdbcUrl { host: host.to_string(), port,