{"record":{"id":"e6c387fe81f32ff3","repo":"apache/druid","slug":"08001","errorCode":"08001","errorMessage":"No suitable driver","messagePattern":"No suitable driver","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"critical","filePath":"server/src/main/java/org/apache/druid/metadata/BasicDataSourceExt.java","lineNumber":151,"sourceCode":"        }\n        catch (Exception t) {\n          String message = \"Cannot load JDBC driver class '\" +\n                           getDriverClassName() + \"'\";\n          LOGGER.error(t, message);\n          throw new SQLException(message, t);\n        }\n      }\n\n      try {\n        if (driverFromCCL == null) {\n          driverToUse = DriverManager.getDriver(getUrl());\n        } else {\n          // Usage of DriverManager is not possible, as it does not\n          // respect the ContextClassLoader\n          // N.B. This cast may cause ClassCastException which is handled below\n          driverToUse = (Driver) driverFromCCL.newInstance();\n          if (!driverToUse.acceptsURL(getUrl())) {\n            throw new SQLException(\"No suitable driver\", \"08001\");\n          }\n        }\n      }\n      catch (Exception t) {\n        String message = \"Cannot create JDBC driver of class '\" +\n                         (getDriverClassName() != null ? getDriverClassName() : \"\") +\n                         \"' for connect URL '\" + getUrl() + \"'\";\n        LOGGER.error(t, message);\n        throw new SQLException(message, t);\n      }\n    }\n\n    if (driverToUse == null) {\n      throw new RE(\"Failed to find the DB Driver\");\n    }\n\n    final Driver finalDriverToUse = driverToUse;\n","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/metadata/BasicDataSourceExt.java#L133-L169","documentation":"When the driver is instantiated reflectively from the context classloader, BasicDataSourceExt validates it with Driver.acceptsURL(getUrl()) and throws SQLException('No suitable driver', SQLState 08001) if the driver rejects the JDBC URL. The configured URL's scheme does not match any registered/loaded driver.","triggerScenarios":"createConnectionFactory where driverFromCCL is instantiated and acceptsURL(getUrl()) returns false — typically a malformed or wrong-protocol JDBC URL (e.g. jdbc:postgresql:// URL with a MySQL driver, missing 'jdbc:' prefix, typo in scheme).","commonSituations":"Copy-pasted JDBC URL with wrong database type; URL built from config placeholders left empty; using a driver that does not support the URL sub-protocol after a database migration.","solutions":["Fix the JDBC URL so its scheme matches the configured driver (e.g. jdbc:postgresql://host:5432/db for PostgreSQL)","Verify the driverClassName corresponds to the same database as the URL","Log/inspect the resolved URL for missing or malformed jdbc: prefix"],"exampleFix":"// before\ndruid.metadata.storage.connector.url=jdbc:postgresql//localhost:5432/druid\n// after\ndruid.metadata.storage.connector.url=jdbc:postgresql://localhost:5432/druid","handlingStrategy":"validation","validationCode":"if (jdbcUrl == null || !jdbcUrl.startsWith(\"jdbc:\")) { throw new IllegalArgumentException(\"Invalid JDBC URL: \" + jdbcUrl); }","typeGuard":null,"tryCatchPattern":"try { dataSource.getConnection(); } catch (SQLException e) { if (\"08001\".equals(e.getSQLState())) { log.error(\"JDBC URL rejected by driver; check url scheme matches driverClassName\"); } throw e; }","preventionTips":["Ensure the URL scheme (jdbc:postgresql:, jdbc:mysql:) matches the configured driver","Validate the JDBC URL format in config before deployment","Keep driver and database server versions compatible"],"tags":["java","jdbc","url","driver"],"backgroundTag":"invalid-url","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}