t8y2/dbx · error · SQLException

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

Error message

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

What it means

The plugin first tries the explicitly registered driver's Driver.connect(url, properties). If that call fails with UnsupportedOperationException or AbstractMethodError — meaning the driver class is present but its connect() is not really implemented for this URL/protocol — the plugin wraps it in a SQLException with this message. This catches drivers that were registered but do not actually accept the given URL scheme.

Solutions

  1. Check that the JDBC URL scheme matches the registered driver (e.g. jdbc:postgresql:... with org.postgresql.Driver).
  2. Register/depend on the official, current driver JAR for the target database instead of a repackaged or partial jar.
  3. Update the driver to a recent release; AbstractMethodError indicates binary incompatibility between driver and JDK/JDBC API version.
  4. Note the plugin falls back to DriverManager.getConnection afterwards — check the follow-up error; if this one persists alone, the registered shim itself is broken, so fix driver discovery/registration.

Example fix

// before
url = "jdbc:mysql://host:3306/db";      // but org.postgresql.Driver registered
// after
url = "jdbc:postgresql://host:5432/db"; // matches registered driver
Defensive patterns

Strategy: try-catch

Validate before calling

// Java: confirm driver accepts the URL scheme before connecting
static boolean driverAccepts(java.sql.Driver d, String url) throws SQLException {
    try { return d.acceptsURL(url); } catch (Exception e) { return false; }
}

Try / catch

try {
    connection = plugin.open(connCfg);
} catch (java.sql.SQLException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("JDBC driver rejected connect")) {
        throw new IllegalStateException("URL scheme does not match registered driver: " + e.getMessage(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling openConnection (via handle/conn/genericTableObjectSource) where registeredDriver.connect() throws UnsupportedOperationException or AbstractMethodError — typically a stub driver, a driver whose class was force-registered from a JAR scan but whose URL scheme (jdbc:xyz:) doesn't match, or an ancient/partial driver implementation.

Common situations: Registering a generic JAR whose discovered class isn't the real Driver, mixing driver versions (old driver jar that lacks connect logic for new URL formats), or dialect mismatch like using a MySQL URL against a registered PostgreSQL driver shim.

Related errors


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

Appendix: source

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

        }
        // Prefer the explicitly registered driver. DriverManager.getConnection only catches
        // SQLException; Hive/Inceptor drivers may throw UnsupportedOperationException for optional
        // methods, which aborts connect before the intended driver is reached.
        sharedConnection = connectWithRegisteredDriver(url, properties);
        sharedConnectionKey = key;
        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();

View on GitHub (pinned to c0390bff16)