{"record":{"id":"254c454e7a41b179","repo":"SonarSource/sonarqube","slug":"unsupported-jdbc-driver-provider-s","errorCode":null,"errorMessage":"Unsupported JDBC driver provider: %s","messagePattern":"Unsupported JDBC driver provider: (.+?)","errorType":"validation","errorClass":"MessageException","httpStatus":null,"severity":"error","filePath":"server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java","lineNumber":125,"sourceCode":"      return Provider.H2;\n    }\n\n    if (isEmpty(url)) {\n      props.set(JDBC_URL.getKey(), buildH2JdbcUrl(JDBC_EMBEDDED_PORT_DEFAULT_VALUE));\n      props.set(JDBC_EMBEDDED_PORT.getKey(), String.valueOf(JDBC_EMBEDDED_PORT_DEFAULT_VALUE));\n      return Provider.H2;\n    }\n\n    Pattern pattern = Pattern.compile(\"jdbc:(\\\\w+):.+\");\n    Matcher matcher = pattern.matcher(url);\n    if (!matcher.find()) {\n      throw new MessageException(format(\"Bad format of JDBC URL: %s\", url));\n    }\n    String key = matcher.group(1);\n    try {\n      return Provider.valueOf(StringUtils.upperCase(key));\n    } catch (IllegalArgumentException e) {\n      throw new MessageException(format(\"Unsupported JDBC driver provider: %s\", key));\n    }\n  }\n\n  private static String buildH2JdbcUrl(int embeddedDatabasePort) {\n    InetAddress ip = InetAddress.getLoopbackAddress();\n    String host;\n    if (ip instanceof Inet6Address) {\n      host = \"[\" + ip.getHostAddress() + \"]\";\n    } else {\n      host = ip.getHostAddress();\n    }\n    return format(\"jdbc:h2:tcp://%s:%d/sonar%s\", host, embeddedDatabasePort, IGNORED_KEYWORDS_OPTION);\n  }\n\n  private static void warnIfUrlIsSet(int port, String existing, String expectedUrl) {\n    if (isNotEmpty(existing)) {\n      Logger logger = LoggerFactory.getLogger(JdbcSettings.class);\n      if (expectedUrl.equals(existing)) {","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java#L107-L143","documentation":"After extracting the sub-protocol from the JDBC URL, JdbcSettings maps it to a Provider enum via Provider.valueOf(upperCase(key)). When the key is not a known provider (e.g. 'oracle' in editions without Oracle support, or a typo like 'postgress'), a MessageException 'Unsupported JDBC driver provider: <key>' is thrown.","triggerScenarios":"Using a JDBC URL whose sub-protocol is not one of the supported Provider enum values (h2, postgresql, sqlserver, mysql in older versions), e.g. jdbc:oracle:thin:@... in an unsupported edition.","commonSituations":"Migrating from an edition that supported Oracle/MySQL to one that does not; typos in the URL sub-protocol; copy-pasting URLs from third-party tutorials.","solutions":["Use a supported provider, e.g. jdbc:postgresql://host:5432/sonar or jdbc:sqlserver://host;databaseName=sonar","Fix typos in the sub-protocol (it is matched case-insensitively but must be a valid enum name)","Check the SonarQube version's supported databases page and migrate off deprecated ones (MySQL/Oracle)","Use the embedded H2 only for testing, not production"],"exampleFix":"// before\nsonar.jdbc.url=jdbc:oracle:thin:@localhost:1521:XE\n// after\nsonar.jdbc.url=jdbc:postgresql://localhost:5432/sonar","handlingStrategy":"validation","validationCode":"Set<String> SUPPORTED = Set.of(\"H2\", \"POSTGRESQL\", \"SQLSERVER\");\nString key = url.split(\":\")[1].toUpperCase(Locale.ROOT);\nif (!SUPPORTED.contains(key)) throw new IllegalArgumentException(\"Unsupported provider: \" + key);","typeGuard":"static boolean isSupportedProvider(String url) { try { String k = url.split(\":\")[1].toUpperCase(Locale.ROOT); return Set.of(\"H2\",\"POSTGRESQL\",\"SQLSERVER\").contains(k); } catch (Exception e) { return false; } }","tryCatchPattern":"try { jdbcSettings.start(); } catch (MessageException e) { if (e.getMessage().startsWith(\"Unsupported JDBC driver provider\")) { migrateToSupportedDb(); } throw e; }","preventionTips":["Check the supported-databases matrix for your SonarQube version before choosing a DB","Plan migrations off deprecated providers (MySQL, Oracle) proactively","Validate the sub-protocol against the Provider enum names","Use H2 only for evaluation, never production"],"tags":["jdbc","database","unsupported","sonarqube"],"backgroundTag":"unsupported-enum-value","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}