SonarSource/sonarqube · error · MessageException

Unsupported JDBC driver provider: %s

Error message

Unsupported JDBC driver provider: %s

What it means

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.

Source

Thrown at server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java:125

      return Provider.H2;
    }

    if (isEmpty(url)) {
      props.set(JDBC_URL.getKey(), buildH2JdbcUrl(JDBC_EMBEDDED_PORT_DEFAULT_VALUE));
      props.set(JDBC_EMBEDDED_PORT.getKey(), String.valueOf(JDBC_EMBEDDED_PORT_DEFAULT_VALUE));
      return Provider.H2;
    }

    Pattern pattern = Pattern.compile("jdbc:(\\w+):.+");
    Matcher matcher = pattern.matcher(url);
    if (!matcher.find()) {
      throw new MessageException(format("Bad format of JDBC URL: %s", url));
    }
    String key = matcher.group(1);
    try {
      return Provider.valueOf(StringUtils.upperCase(key));
    } catch (IllegalArgumentException e) {
      throw new MessageException(format("Unsupported JDBC driver provider: %s", key));
    }
  }

  private static String buildH2JdbcUrl(int embeddedDatabasePort) {
    InetAddress ip = InetAddress.getLoopbackAddress();
    String host;
    if (ip instanceof Inet6Address) {
      host = "[" + ip.getHostAddress() + "]";
    } else {
      host = ip.getHostAddress();
    }
    return format("jdbc:h2:tcp://%s:%d/sonar%s", host, embeddedDatabasePort, IGNORED_KEYWORDS_OPTION);
  }

  private static void warnIfUrlIsSet(int port, String existing, String expectedUrl) {
    if (isNotEmpty(existing)) {
      Logger logger = LoggerFactory.getLogger(JdbcSettings.class);
      if (expectedUrl.equals(existing)) {

View on GitHub (pinned to 184c821202)

Solutions

  1. Use a supported provider, e.g. jdbc:postgresql://host:5432/sonar or jdbc:sqlserver://host;databaseName=sonar
  2. Fix typos in the sub-protocol (it is matched case-insensitively but must be a valid enum name)
  3. Check the SonarQube version's supported databases page and migrate off deprecated ones (MySQL/Oracle)
  4. Use the embedded H2 only for testing, not production

Example fix

// before
sonar.jdbc.url=jdbc:oracle:thin:@localhost:1521:XE
// after
sonar.jdbc.url=jdbc:postgresql://localhost:5432/sonar
Defensive patterns

Strategy: validation

Validate before calling

Set<String> SUPPORTED = Set.of("H2", "POSTGRESQL", "SQLSERVER");
String key = url.split(":")[1].toUpperCase(Locale.ROOT);
if (!SUPPORTED.contains(key)) throw new IllegalArgumentException("Unsupported provider: " + key);

Type guard

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; } }

Try / catch

try { jdbcSettings.start(); } catch (MessageException e) { if (e.getMessage().startsWith("Unsupported JDBC driver provider")) { migrateToSupportedDb(); } throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/254c454e7a41b179. Report an issue: GitHub.