{"record":{"id":"b1fe8e994e1fa338","repo":"alibaba/druid","slug":"not-support-oracle-driver","errorCode":null,"errorMessage":"not support oracle driver {}.{}","messagePattern":"not support oracle driver (.+?)\\.(.+?)","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java","lineNumber":1162,"sourceCode":"            }\n        }\n    }\n\n    protected void initCheck() throws SQLException {\n        DbType dbType = DbType.of(this.dbTypeName);\n\n        if (dbType == DbType.oracle) {\n            isOracle = true;\n\n            // Some Oracle-compatible databases may use non-Oracle JDBC drivers (e.g. YashanDB),\n            // whose version numbers are not aligned with Oracle's. In that case, skip the Oracle\n            // JDBC major version check but still treat the datasource as Oracle style.\n            final String driverClassName = this.driverClass;\n            final boolean oracleCompatibleNonOracleDriver =\n                    driverClassName != null && driverClassName.startsWith(\"com.yashandb.jdbc.\");\n\n            if (!oracleCompatibleNonOracleDriver && driver.getMajorVersion() < 10) {\n                throw new SQLException(\"not support oracle driver \" + driver.getMajorVersion() + \".\"\n                        + driver.getMinorVersion());\n            }\n\n            if (driver.getMajorVersion() == 10 && isUseOracleImplicitCache()) {\n                this.getConnectProperties().setProperty(\"oracle.jdbc.FreeMemoryOnEnterImplicitCache\", \"true\");\n            }\n\n            oracleValidationQueryCheck();\n        } else if (dbType == DbType.db2) {\n            db2ValidationQueryCheck();\n        } else if (dbType == DbType.mysql\n                || JdbcUtils.MYSQL_DRIVER.equals(this.driverClass)\n                || JdbcUtils.MYSQL_DRIVER_6.equals(this.driverClass)\n                || JdbcUtils.MYSQL_DRIVER_603.equals(this.driverClass)\n                || JdbcUtils.GOLDENDB_DRIVER.equals(this.driverClass)\n                || JdbcUtils.GBASE8S_DRIVER.equals(this.driverClass)\n                || JdbcUtils.POLARDBX_DRIVER.equals(this.driverClass)\n        ) {","sourceCodeStart":1144,"sourceCodeEnd":1180,"githubUrl":"https://github.com/alibaba/druid/blob/fa8dc9912637a2f729eef9f55356621fec18d40e/core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java#L1144-L1180","documentation":"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.","triggerScenarios":"initCheck() with dbType oracle, driver not a yashandb-compatible class, and driver.getMajorVersion() < 10. The check at line 1161 throws, printing major.minor.","commonSituations":"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.","solutions":["Upgrade the Oracle JDBC driver to ojdbc6/ojdbc8/ojdbc11 (10g+) or newer on the classpath.","Remove conflicting older ojdbc JARs from the classpath and confirm with driver.getMajorVersion().","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."],"exampleFix":"// before\n// pom has the legacy ojdbc14 (9i) -> getMajorVersion()==9 -> throws\n// after\n<dependency>\n  <groupId>com.oracle.database.jdbc</groupId>\n  <artifactId>ojdbc8</artifactId>\n  <version>21.9.0.0</version>\n</dependency>","handlingStrategy":"validation","validationCode":"java.sql.Driver drv = dataSource.getDriver();\nif (drv != null && \"oracle\".equalsIgnoreCase(JdbcUtils.getDbType(dataSource.getJdbcUrl(), null))\n    && !drv.getClass().getName().startsWith(\"com.yashandb.jdbc.\")\n    && drv.getMajorVersion() < 10) {\n    throw new IllegalStateException(\"Oracle driver too old: \" + drv.getMajorVersion() + \".\" + drv.getMinorVersion());\n}","typeGuard":null,"tryCatchPattern":"try {\n    dataSource.init();\n} catch (SQLException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"not support oracle driver\")) {\n        throw new IllegalStateException(\"Upgrade ojdbc to 10g+ (e.g. ojdbc8/ojdbc11)\", e);\n    }\n    throw e;\n}","preventionTips":["Use a modern Oracle JDBC driver (ojdbc8/11/21) and remove legacy ojdbc JARs.","Pin the driver version explicitly in your build to avoid transitive old drivers.","If using an Oracle-compatible non-Oracle DB, confirm its driver class prefix is supported."],"tags":["oracle","driver","version","init","compatibility"],"backgroundTag":null,"analyzedSha":"fa8dc9912637a2f729eef9f55356621fec18d40e","analyzedAt":"2026-08-14T04:55:06.789Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}