brettwooldridge/HikariCP · critical · RuntimeException
Driver {} claims to not accept jdbcUrl, {}
Error message
Driver {} claims to not accept jdbcUrl, {} What it means
DriverDataSource constructor verifies that a driver explicitly configured via dataSourceClassName/driverClassName actually accepts the jdbcUrl (driver.acceptsURL). If it returns false, HikariCP throws RuntimeException naming the driver class and (password-masked) URL — the driver and URL do not match.
Source
Thrown at src/main/java/com/zaxxer/hikari/util/DriverDataSource.java:116
if (driverClass != null) {
try {
driver = (Driver) driverClass.getDeclaredConstructor().newInstance();
} catch (Exception e) {
LOGGER.warn("Failed to create instance of driver class {}, trying jdbcUrl resolution", driverClassName, e);
}
}
}
}
final var sanitizedUrl = maskPasswordInJdbcUrl(jdbcUrl);
try {
if (driver == null) {
driver = DriverManager.getDriver(jdbcUrl);
LOGGER.debug("Loaded driver with class name {} for jdbcUrl={}", driver.getClass().getName(), sanitizedUrl);
}
else if (!driver.acceptsURL(jdbcUrl)) {
throw new RuntimeException("Driver " + driverClassName + " claims to not accept jdbcUrl, " + sanitizedUrl);
}
}
catch (SQLException e) {
throw new RuntimeException("Failed to get driver instance for jdbcUrl=" + sanitizedUrl, e);
}
}
@Override
public Connection getConnection() throws SQLException
{
return driver.connect(jdbcUrl, driverProperties);
}
@Override
public Connection getConnection(final String username, final String password) throws SQLException
{
final var cloned = (Properties) driverProperties.clone();
if (username != null) {View on GitHub (pinned to a4d93f4f85)
Solutions
- Align driverClassName with the jdbcUrl family (e.g. org.mariadb.jdbc.Driver with jdbc:mariadb://)
- Drop driverClassName entirely and let DriverManager auto-detect from the URL (HikariCP resolves it via jdbcUrl)
- Fix typos in the jdbc:subprotocol and verify the URL against the driver docs
- Upgrade the driver if its acceptsURL is known to be buggy for your URL form
Example fix
# before spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mariadb://db:3306/app # after driver-class-name=org.mariadb.jdbc.Driver url=jdbc:mariadb://db:3306/app
Defensive patterns
Strategy: validation
Validate before calling
// sanity-check before pool creation
Driver d = DriverManager.getDriver(jdbcUrl);
if (explicitDriver != null && !explicitDriver.acceptsURL(jdbcUrl)) {
throw new IllegalStateException("driver/url mismatch");
} Prevention
- Keep driverClassName and jdbcUrl family aligned
- Omit driverClassName and rely on URL auto-detection
- Add a config validation step at startup
When it happens
Trigger: Setting jdbcUrl to one database family (e.g. jdbc:mysql://) while driverClassName points at another driver (e.g. org.postgresql.Driver); a driver whose acceptsURL is strict about URL syntax/extra properties; wrong/typo'd jdbc: subprotocol.
Common situations: Copy-pasted configs across environments, MySQL vs MariaDB driver mixups (jdbc:mariadb:// with com.mysql.cj.jdbc.Driver), custom sharding proxies whose acceptsURL differs by version.
Related errors
- Failed to get driver instance for jdbcUrl={}
- Failed to load class ${className}
- Invalid transaction isolation value: ${transactionIsolationN
- connectionTimeout cannot be less than ${SOFT_TIMEOUT_FLOOR}m
- idleTimeout cannot be negative
AI-assisted analysis of brettwooldridge/HikariCP@a4d93f4f85 (2026-08-14).
Data as JSON: /api/errors/dd5cca7a1606076b.
Report an issue: GitHub.