apache/seatunnel · error · OptionValidationException

Invalid SAP HANA JDBC URL format

Error message

Invalid SAP HANA JDBC URL format: [%s], expected pattern: jdbc:sap://host:port

What it means

The SAP HANA JDBC URL validator in SapHanaCatalogFactory.evaluate() parses the configured URL with SapHanaURLParser; when the parser raises IllegalArgumentException (URL does not match jdbc:sap://host:port), the factory rethrows it as an OptionValidationException stating the expected pattern. This prevents a malformed URL from silently matching the dialect and failing later at connection time.

Solutions

  1. Fix the url option to match jdbc:sap://host:port (plus optional path/params), e.g. jdbc:sap://hana-host:30015.
  2. Confirm the scheme is exactly jdbc:sap:// and both host and port are present and non-empty.
  3. Check for stray whitespace, quotes, or characters around the URL in the config file.
  4. Test the corrected URL with SapHanaURLParser or a plain JDBC connection before rerunning the job.

Example fix

// before
url = "jdbc:sap://hana-host"          # missing port
# after
url = "jdbc:sap://hana-host:30015"
Defensive patterns

Strategy: validation

Validate before calling

// java
String url = config.get("url");
if (url == null || !url.matches("jdbc:sap://[^:/\\s]+:\\d+.*")) {
    throw new IllegalArgumentException("SAP HANA url must match jdbc:sap://host:port, got: " + url);
}

Prevention

When it happens

Trigger: Configuring a jdbc-sap HANA catalog/connection where the url option is present but malformed — e.g. missing host, missing port, wrong scheme (jdbc:hana://, jdbc:sap:/host), or trailing garbage the parser cannot handle.

Common situations: Copy-pasting a HANA JDBC URL from another tool with extra parameters misplaced; omitting the port (HANA typically requires instance-specific port like 30013/30015); using the wrong scheme prefix; typos like jdbc:sap//.

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 apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/930036ef113fd770. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/saphana/SapHanaCatalogFactory.java:76

        return JdbcCommonOptions.baseCatalogRule(new SapHanaUrlValidator()).build();
    }

    static class SapHanaUrlValidator implements ConditionExtension<String> {
        @Override
        public String description() {
            return "SAP HANA JDBC URL must be a valid format (e.g. jdbc:sap://host:port)";
        }

        @Override
        public boolean evaluate(ReadonlyConfig config, String url) {
            if (url == null || url.trim().isEmpty()) {
                return false;
            }
            try {
                JdbcUrlUtil.UrlInfo info = SapHanaURLParser.parse(url);
                return StringUtils.isNotBlank(info.getHost());
            } catch (IllegalArgumentException e) {
                throw new OptionValidationException(
                        String.format(
                                "Invalid SAP HANA JDBC URL format: [%s], "
                                        + "expected pattern: jdbc:sap://host:port",
                                url));
            }
        }
    }
}

View on GitHub (pinned to cf67b549a7)