risingwavelabs/risingwave · error

invalid jdbc url, to switch to postgres rust connector, we…

Error message

invalid jdbc url, to switch to postgres rust connector, we need to use the url jdbc:postgresql://...

What it means

In RisingWave's stream sink creation, `parse_jdbc_url` validates that a JDBC sink URL uses the `jdbc:postgresql` scheme so the built-in Rust postgres connector can be used. Any URL that does not start with `jdbc:postgresql` is rejected with this bail. It signals that the sink connector cannot translate the URL into a postgres connection.

Solutions

  1. Prefix the sink URL with `jdbc:`, e.g. change `postgresql://host:5432/db` to `jdbc:postgresql://host:5432/db`.
  2. Ensure the database is actually PostgreSQL; the rust connector only supports postgres — use a different sink connector for MySQL etc.
  3. Check the `jdbc.url` property key in `CREATE SINK ... WITH (...)` for typos or truncated values from the client.
  4. Run `SHOW SINK` / recreate the sink after fixing the URL.

Example fix

// before
CREATE SINK s FROM mv WITH (connector='jdbc', jdbc.url='postgresql://host:5432/db');
// after
CREATE SINK s FROM mv WITH (connector='jdbc', jdbc.url='jdbc:postgresql://host:5432/db');
Defensive patterns

Strategy: validation

Validate before calling

fn valid_jdbc_url(url: &str) -> bool { url.starts_with("jdbc:postgresql") }
if !valid_jdbc_url(jdbc_url) { panic!("sink jdbc.url must start with jdbc:postgresql") }

Type guard

fn is_jdbc_postgres_url(url: &str) -> bool { url.starts_with("jdbc:postgresql://") }

Prevention

When it happens

Trigger: Creating a JDBC sink whose `jdbc.url` property starts with something other than `jdbc:postgresql` (e.g. `jdbc:mysql://`, `jdbc:oracle://`, or a plain `postgresql://` URL without the `jdbc:` prefix). The check runs in `parse_jdbc_url` when the sink executor is built (`new_boxed_executor`).

Common situations: Users copying connection strings from MySQL/Oracle JDBC drivers or from DBeaver/pgAdmin; users pasting a bare `postgresql://` URL omitting the `jdbc:` prefix; doc examples for other databases.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/fadae88e0f7965f3. Report an issue: GitHub.

Appendix: source

Thrown at src/stream/src/from_proto/sink.rs:389

                .boxed()
            }
        };

        Ok((params.info, exec).into())
    }
}

struct JdbcUrl {
    host: String,
    port: u16,
    db_name: String,
    username: Option<String>,
    password: Option<String>,
}

fn parse_jdbc_url(url: &str) -> anyhow::Result<JdbcUrl> {
    if !url.starts_with("jdbc:postgresql") {
        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
        .host_str()
        .ok_or_else(|| anyhow!("missing host in jdbc url"))?;
    let port = url
        .port()
        .ok_or_else(|| anyhow!("missing port in jdbc url"))?;

View on GitHub (pinned to 6469eb736d)