t8y2/dbx · error · SQLException

JDBC DriverManager rejected connect for URL '" + url + "'

Error message

JDBC DriverManager rejected connect for URL '" + url + "'

What it means

Final fallback in the connect path: after the registered driver declines, the plugin calls DriverManager.getConnection(url, properties). If that also throws UnsupportedOperationException or AbstractMethodError, it is wrapped in this SQLException. It signals the JDK's DriverManager could not perform the connect due to an unimplemented/unsupported driver method rather than an ordinary SQL failure.

Source

Thrown at plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java:684

        configureOrdinaryAutoCommit(sharedConnection);
        return sharedConnection;
    }

    private static Connection connectWithRegisteredDriver(String url, Properties properties) throws SQLException {
        if (registeredDriver != null) {
            try {
                Connection connection = registeredDriver.connect(url, properties);
                if (connection != null) {
                    return connection;
                }
            } catch (UnsupportedOperationException | AbstractMethodError error) {
                throw new SQLException("JDBC driver rejected connect for URL '" + url + "'", error);
            }
        }
        try {
            return DriverManager.getConnection(url, properties);
        } catch (UnsupportedOperationException | AbstractMethodError error) {
            throw new SQLException("JDBC DriverManager rejected connect for URL '" + url + "'", error);
        }
    }

    private static String describeThrowable(Throwable error) {
        if (error == null) {
            return "unknown error";
        }
        String message = error.getMessage();
        if (message != null && !message.isBlank()
            && !message.equals(error.getClass().getName())
            && !message.equals(error.getClass().getSimpleName())) {
            return error.getClass().getName() + ": " + message.trim();
        }
        StackTraceElement[] stack = error.getStackTrace();
        if (stack != null && stack.length > 0) {
            StackTraceElement top = stack[0];
            return error.getClass().getName() + " at " + top.getClassName() + "." + top.getMethodName()
                + "(" + top.getFileName() + ":" + top.getLineNumber() + ")";

View on GitHub (pinned to c0390bff16)

Solutions

  1. Upgrade to a JDBC 4+ driver (single-jar, services-registered) for the target database.
  2. Ensure the driver JAR is on the system classpath or that DriverManager is aware of it (Class.forName may be needed for legacy drivers).
  3. Match JDK and driver versions (e.g. ojdbc8+ on JDK 8+, mssql-jdbc 12.x on modern JDKs) to eliminate AbstractMethodError.
  4. Check the wrapped cause: AbstractMethodError names the missing method and the offending driver class.

Example fix

// before
classpath: mysql-connector-java-3.1.14.jar   // JDBC 3 era
// after
classpath: mysql-connector-j-8.4.0.jar       // JDBC 4+, services-registered
Defensive patterns

Strategy: try-catch

Validate before calling

// Java: pre-flight DriverManager check
static void assertDriverManagerReady(String url) {
    try {
        if (java.sql.DriverManager.getDrivers().hasMoreElements() == false)
            throw new IllegalStateException("no JDBC drivers registered with DriverManager");
    } catch (Exception e) {
        throw new IllegalStateException("DriverManager unusable for " + url, e);
    }
}

Try / catch

try {
    connection = plugin.open(connCfg);
} catch (java.sql.SQLException e) {
    Throwable c = e.getCause();
    if (c instanceof AbstractMethodError || c instanceof UnsupportedOperationException) {
        throw new IllegalStateException("Driver incompatible with this JDK; upgrade the driver jar", c);
    }
    throw e;
}

Prevention

When it happens

Trigger: DriverManager.getConnection throwing UnsupportedOperationException or AbstractMethodError — e.g. no suitable driver with a broken service loader, a driver incompatible with the current Java version, or a JDBC 3 (pre-4) driver lacking the required connect overloads being routed through modern paths.

Common situations: Running an old legacy driver on a modern JDK, classloader issues where DriverManager cannot see the driver class (driver loaded from plugin classloader not visible to system DriverManager), or a driver jar missing META-INF/services registration.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/2d2cdde2a85ca9d0. Report an issue: GitHub.