alibaba/druid · error · SQLException

not support oracle driver {}.{}

Error message

not support oracle driver {}.{}

What it means

SQLException thrown in initCheck() when the datasource is Oracle (dbType == oracle) and the resolved JDBC driver reports a major version below 10, unless the driver class is an Oracle-compatible non-Oracle driver (e.g. com.yashandb.jdbc.*). Druid relies on Oracle driver features (10g+) for correct behavior, so older Oracle drivers are rejected.

Source

Thrown at core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java:1162

            }
        }
    }

    protected void initCheck() throws SQLException {
        DbType dbType = DbType.of(this.dbTypeName);

        if (dbType == DbType.oracle) {
            isOracle = true;

            // Some Oracle-compatible databases may use non-Oracle JDBC drivers (e.g. YashanDB),
            // whose version numbers are not aligned with Oracle's. In that case, skip the Oracle
            // JDBC major version check but still treat the datasource as Oracle style.
            final String driverClassName = this.driverClass;
            final boolean oracleCompatibleNonOracleDriver =
                    driverClassName != null && driverClassName.startsWith("com.yashandb.jdbc.");

            if (!oracleCompatibleNonOracleDriver && driver.getMajorVersion() < 10) {
                throw new SQLException("not support oracle driver " + driver.getMajorVersion() + "."
                        + driver.getMinorVersion());
            }

            if (driver.getMajorVersion() == 10 && isUseOracleImplicitCache()) {
                this.getConnectProperties().setProperty("oracle.jdbc.FreeMemoryOnEnterImplicitCache", "true");
            }

            oracleValidationQueryCheck();
        } else if (dbType == DbType.db2) {
            db2ValidationQueryCheck();
        } else if (dbType == DbType.mysql
                || JdbcUtils.MYSQL_DRIVER.equals(this.driverClass)
                || JdbcUtils.MYSQL_DRIVER_6.equals(this.driverClass)
                || JdbcUtils.MYSQL_DRIVER_603.equals(this.driverClass)
                || JdbcUtils.GOLDENDB_DRIVER.equals(this.driverClass)
                || JdbcUtils.GBASE8S_DRIVER.equals(this.driverClass)
                || JdbcUtils.POLARDBX_DRIVER.equals(this.driverClass)
        ) {

View on GitHub (pinned to fa8dc99126)

Solutions

  1. Upgrade the Oracle JDBC driver to ojdbc6/ojdbc8/ojdbc11 (10g+) or newer on the classpath.
  2. Remove conflicting older ojdbc JARs from the classpath and confirm with driver.getMajorVersion().
  3. If using an Oracle-compatible DB with a non-Oracle driver whose version is not aligned, ensure the driver class name starts with the supported prefix or switch to a supported Oracle-compatible driver.

Example fix

// before
// pom has the legacy ojdbc14 (9i) -> getMajorVersion()==9 -> throws
// after
<dependency>
  <groupId>com.oracle.database.jdbc</groupId>
  <artifactId>ojdbc8</artifactId>
  <version>21.9.0.0</version>
</dependency>
Defensive patterns

Strategy: validation

Validate before calling

java.sql.Driver drv = dataSource.getDriver();
if (drv != null && "oracle".equalsIgnoreCase(JdbcUtils.getDbType(dataSource.getJdbcUrl(), null))
    && !drv.getClass().getName().startsWith("com.yashandb.jdbc.")
    && drv.getMajorVersion() < 10) {
    throw new IllegalStateException("Oracle driver too old: " + drv.getMajorVersion() + "." + drv.getMinorVersion());
}

Try / catch

try {
    dataSource.init();
} catch (SQLException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("not support oracle driver")) {
        throw new IllegalStateException("Upgrade ojdbc to 10g+ (e.g. ojdbc8/ojdbc11)", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: initCheck() with dbType oracle, driver not a yashandb-compatible class, and driver.getMajorVersion() < 10. The check at line 1161 throws, printing major.minor.

Common situations: An old Oracle JDBC driver (e.g. classes12.jar / 9i driver) on the classpath; a transitive dependency pulling in a legacy ojdbc; using a driver bundled with an ancient application server; pointing at an Oracle-compatible DB whose driver is correctly exempt only if it starts with com.yashandb.jdbc.

Related errors


AI-assisted analysis of alibaba/druid@fa8dc99126 (2026-08-14). Data as JSON: /api/errors/b1fe8e994e1fa338. Report an issue: GitHub.