apache/seatunnel · error · OptionValidationException

Invalid Oracle JDBC URL format: [%s], expected pattern: jdbc

Error message

Invalid Oracle JDBC URL format: [%s], expected pattern: jdbc:oracle:thin:@host:port/service

What it means

OracleCatalogFactory.evaluate validates Oracle JDBC URLs by parsing them with OracleURLParser; when parsing throws IllegalArgumentException it rethrows OptionValidationException with a message showing the URL and expected format jdbc:oracle:thin:@host:port/service. It means the configured URL is not a service-name thin URL the parser accepts.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/oracle/OracleCatalogFactory.java:79

    }

    static class OracleUrlValidator implements ConditionExtension<String> {
        @Override
        public String description() {
            return "Oracle JDBC URL must contain a service name (e.g. jdbc:oracle:thin:@host:port/service)";
        }

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

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Rewrite the URL to thin service-name form: jdbc:oracle:thin:@host:port/service
  2. Convert SID URLs to service-name form (or register a parser path that supports SID)
  3. Trim whitespace/quotes from the configured url option
  4. If TNS descriptors are required, extend OracleURLParser to accept them

Example fix

// before
url = "jdbc:oracle:thin:@orclhost:1521:ORCLCDB";
// after
url = "jdbc:oracle:thin:@orclhost:1521/ORCLPDB1";
Defensive patterns

Strategy: validation

Validate before calling

// validate the URL before configuring the catalog
String url = cfg.getString("url");
java.util.regex.Pattern p = java.util.regex.Pattern.compile("jdbc:oracle:thin:@[A-Za-z0-9._-]+:\\d+/[A-Za-z0-9_$#]+");
if (!p.matcher(url.trim()).matches()) { throw new IllegalArgumentException("Oracle URL must be jdbc:oracle:thin:@host:port/service"); }

Type guard

boolean isThinServiceUrl(String url) {
    return url != null && url.trim().matches("jdbc:oracle:thin:@[^:]+:\\d+/.+");
}

Try / catch

try { factory.evaluate(...); } catch (OptionValidationException e) { /* re-prompt/fix url option */ }

Prevention

When it happens

Trigger: Configuring an Oracle/OceanBase-Oracle url like jdbc:oracle:thin:@(DESCRIPTION=...), SID-style @host:port:SID, empty host, or missing service name, then running URL validation during catalog/connector option evaluation.

Common situations: Using TNS descriptor URLs, legacy SID URLs, typos in host/port, missing /service suffix, or copying a URL with extra whitespace.

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