testcontainers/testcontainers-java · error · UnsupportedOperationException

The Oracle Database driver does not support this

Error message

The Oracle Database driver does not support this

What it means

OracleContainer.withUrlParam unconditionally throws UnsupportedOperationException. Oracle JDBC URLs (SID/service-name based) don't support the generic extra URL parameters that other Testcontainers RDBMS modules allow, so this API is intentionally not implemented for Oracle.

Solutions

  1. Remove the withUrlParam call
  2. Pass Oracle-specific options via withUrlParam alternatives: use JDBC connection properties on the DriverManager/DataSource instead (e.g. oracle.jdbc properties)
  3. Use withStartupTimeout / container config or a custom init script for behavior you were trying to toggle

Example fix

// before
container.withUrlParam("useSSL", "true");
// after
container.withUsername("app").withPassword("pw"); // configure via credentials/init scripts
Properties props = new Properties();
props.put("oracle.jdbc.ReadTimeout", "5000"); // set driver props on your DataSource instead
Defensive patterns

Strategy: validation

Validate before calling

// never call withUrlParam on OracleContainer; configure driver props on your DataSource instead

Type guard

boolean supportsUrlParam(JdbcDatabaseContainer c) { return !(c instanceof OracleContainer); }

Try / catch

try { container.withUrlParam(k, v); } catch (UnsupportedOperationException e) { /* apply driver property on DataSource instead */ }

Prevention

When it happens

Trigger: Any call to oracleContainer.withUrlParam("sslmode", "require") or any other param name/value pair.

Common situations: Copy-pasting container setup code from PostgreSQL/MySQL modules that use withUrlParam; attempting to append JDBC options like connection properties to an Oracle container.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of testcontainers/testcontainers-java@8e549514e3 (2026-09-12). Data as JSON: /api/errors/92184ddc98445ed2. Report an issue: GitHub.

Appendix: source

Thrown at modules/oracle-xe/src/main/java/org/testcontainers/containers/OracleContainer.java:190

            throw new IllegalArgumentException("Database name cannot be null or empty");
        }

        if (DEFAULT_DATABASE_NAME.equals(databaseName.toLowerCase())) {
            throw new IllegalArgumentException("Database name cannot be set to " + DEFAULT_DATABASE_NAME);
        }

        this.databaseName = databaseName;
        return self();
    }

    public OracleContainer usingSid() {
        this.usingSid = true;
        return self();
    }

    @Override
    public OracleContainer withUrlParam(String paramName, String paramValue) {
        throw new UnsupportedOperationException("The Oracle Database driver does not support this");
    }

    @SuppressWarnings("SameReturnValue")
    public String getSid() {
        return DEFAULT_SID;
    }

    public Integer getOraclePort() {
        return getMappedPort(ORACLE_PORT);
    }

    @SuppressWarnings("unused")
    public Integer getWebPort() {
        return getMappedPort(APEX_HTTP_PORT);
    }

    @Override
    public String getTestQueryString() {

View on GitHub (pinned to 8e549514e3)