{"record":{"id":"20a84182192b4df4","repo":"apache/druid","slug":"failed-to-find-mariadb-driver-class-please-check","errorCode":null,"errorMessage":"Failed to find MariaDB driver class. Please check the MariaDB connector is in the classpath","messagePattern":"Failed to find MariaDB driver class\\. Please check the MariaDB connector is in the classpath","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/utils/ConnectionUriUtils.java","lineNumber":149,"sourceCode":"          throw new RuntimeException(otherMaria2x);\n        }\n      }\n      catch (IllegalArgumentException iaeMySql) {\n        throw iaeMySql;\n      }\n      catch (Throwable otherMysql) {\n        throw new RuntimeException(otherMysql);\n      }\n    } else if (connectionUri.startsWith(MARIADB_PREFIX)) {\n      try {\n        return tryParseMariaDb2xConnectionUri(connectionUri);\n      }\n      catch (ClassNotFoundException notFoundMaria2x) {\n        try {\n          return tryParseMariaDb3xConnectionUri(connectionUri);\n        }\n        catch (ClassNotFoundException notFoundMaria3x) {\n          throw new RuntimeException(\n              \"Failed to find MariaDB driver class. Please check the MariaDB connector is in the classpath\",\n              notFoundMaria2x\n          );\n        }\n        catch (IllegalArgumentException iaeMaria3x) {\n          throw iaeMaria3x;\n        }\n        catch (Throwable otherMaria3x) {\n          throw new RuntimeException(otherMaria3x);\n        }\n      }\n      catch (IllegalArgumentException iaeMaria2x) {\n        throw iaeMaria2x;\n      }\n      catch (Throwable otherMaria2x) {\n        throw new RuntimeException(otherMaria2x);\n      }\n    } else if (connectionUri.startsWith(POSTGRES_PREFIX)) {","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/utils/ConnectionUriUtils.java#L131-L167","documentation":"tryParseJdbcUriParameters, when handling a mysql JDBC URI, first tries MySQL Connector/J, then MariaDB 3.x, then MariaDB 2.x. If all three driver classes are missing from the classpath, it throws this RuntimeException telling the user to add a MariaDB connector (chained from the first ClassNotFoundException).","triggerScenarios":"Parsing a jdbc:mysql URI when the MySQL 8.x driver is absent and both MariaDB driver major versions are also not on the classpath.","commonSituations":"Minimal Druid distributions without any MySQL/MariaDB metadata-storage extension, custom builds that pruned JDBC jars, or MariaDB connector upgrades that changed the driver class package names out from under the reflective lookup.","solutions":["Add the MariaDB connector jar (org.mariadb.jdbc) to the classpath/extensions directory.","Or add mysql-connector-j so the primary MySQL path succeeds first.","Check druid.extensions.loadList includes mysql-metadata-storage or equivalent.","Verify the expected driver class names match your connector version (package names changed across MariaDB 2.x/3.x)."],"exampleFix":"// before: no MariaDB driver installed, mysql URI being parsed\n// after: add to classpath\n// <dependency>\n//   <groupId>org.mariadb.jdbc</groupId>\n//   <artifactId>mariadb-java-client</artifactId>\n//   <version>3.3.3</version>\n// </dependency>","handlingStrategy":"try-catch","validationCode":"static boolean mariaDbDriverPresent() {\n  try {\n    Class.forName(\"org.mariadb.jdbc.Driver\");\n    return true;\n  } catch (ClassNotFoundException e) {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  params = ConnectionUriUtils.tryParseJdbcUriParameters(uri, false);\n} catch (RuntimeException e) {\n  if (e.getMessage().startsWith(\"Failed to find MariaDB driver class\")) {\n    log.error(\"MariaDB connector missing from classpath; add mariadb-java-client\");\n  }\n  throw e;\n}","preventionTips":["Ship a MariaDB connector jar (or MySQL connector) with the deployment","Check driver class names after upgrading MariaDB connector majors (2.x vs 3.x packages differ)","Validate extension loadList at startup","Run a JDBC connectivity smoke test before processing mysql URIs"],"tags":["jdbc","mariadb","classpath","dependency"],"backgroundTag":"missing-dependency","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}