apache/seatunnel · error · OptionValidationException

Invalid YashanDB JDBC URL

Error message

Invalid YashanDB JDBC URL: [%s], URL must start with '%s'

What it means

The YashanDB JDBC URL validator in YashanDbCatalogFactory.evaluate() requires the URL to start with the YASHANDB_URL_PREFIX; otherwise it throws OptionValidationException 'Invalid YashanDB JDBC URL: [%s], URL must start with <prefix>'. This fail-fast check ensures only YashanDB-scheme URLs are matched to this dialect before further parsing via JdbcUrlUtil.getUrlInfo.

Solutions

  1. Prefix the URL with the required YashanDB scheme exactly as stated in the message (check YASHANDB_URL_PREFIX, e.g. jdbc:yashandb://).
  2. Confirm there is no leading whitespace/BOM in the config value before the scheme.
  3. If the instance is actually another database, configure the correct dialect/factory instead of yashandb.
  4. After fixing the prefix, ensure host/port parse correctly via JdbcUrlUtil (the next validation step).

Example fix

// before
url = "jdbc:oracle://yashan-host:1688"
// after
url = "jdbc:yashandb://yashan-host:1688"
Defensive patterns

Strategy: validation

Validate before calling

// java
String url = config.get("url");
if (url == null || !url.trim().startsWith("jdbc:yashandb://")) {
    throw new IllegalArgumentException("YashanDB url must start with jdbc:yashandb://");
}

Prevention

When it happens

Trigger: Configuring a YashanDB catalog/connection whose url option does not begin with the required YashanDB prefix (e.g. jdbc:yashandb://) — wrong scheme, typo, empty prefix handling, or a URL intended for another database routed to the yashandb factory.

Common situations: Using jdbc:oracle:// or generic jdbc: URLs for a YashanDB instance (YashanDB is Oracle-compatible, tempting users to reuse Oracle URLs); typos like jdbc:yashan://; extra leading whitespace that survives into the trimmed check.

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/a5e69a258c9447b4. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/yashandb/YashanDbCatalogFactory.java:80

     * YashanDB-specific URL validator that rejects any JDBC URL not starting with {@code
     * jdbc:yasdb://} before the catalog is created, providing fail-fast behaviour at configuration
     * parsing time.
     */
    static class YashanDbUrlValidator implements ConditionExtension<String> {
        @Override
        public String description() {
            return "YashanDB JDBC URL must start with '"
                    + YASHANDB_URL_PREFIX
                    + "' (e.g. jdbc:yasdb://host:port/database)";
        }

        @Override
        public boolean evaluate(ReadonlyConfig config, String url) {
            if (url == null || url.trim().isEmpty()) {
                return false;
            }
            if (!url.startsWith(YASHANDB_URL_PREFIX)) {
                throw new OptionValidationException(
                        String.format(
                                "Invalid YashanDB JDBC URL: [%s], URL must start with '%s'",
                                url, YASHANDB_URL_PREFIX));
            }
            try {
                JdbcUrlUtil.UrlInfo info = JdbcUrlUtil.getUrlInfo(url);
                return info.getHost() != null && !info.getHost().isEmpty();
            } catch (IllegalArgumentException e) {
                throw new OptionValidationException(
                        String.format(
                                "Invalid YashanDB JDBC URL format: [%s], "
                                        + "expected pattern: jdbc:yasdb://host:port[/database][?properties]",
                                url));
            }
        }
    }
}

View on GitHub (pinned to cf67b549a7)