{"record":{"id":"8376994cb2213fdb","repo":"apache/druid","slug":"unknown-jdbc-connection-scheme-s","errorCode":null,"errorMessage":"Unknown JDBC connection scheme: %s","messagePattern":"Unknown JDBC connection scheme: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/utils/ConnectionUriUtils.java","lineNumber":180,"sourceCode":"        throw iaeMaria2x;\n      }\n      catch (Throwable otherMaria2x) {\n        throw new RuntimeException(otherMaria2x);\n      }\n    } else if (connectionUri.startsWith(POSTGRES_PREFIX)) {\n      try {\n        return tryParsePostgresConnectionUri(connectionUri);\n      }\n      catch (IllegalArgumentException iaePostgres) {\n        throw iaePostgres;\n      }\n      catch (Throwable otherPostgres) {\n        // no special handling for class not found because postgres driver is in distribution and should be available.\n        throw new RuntimeException(otherPostgres);\n      }\n    } else {\n      if (!allowUnknown) {\n        throw new IAE(\"Unknown JDBC connection scheme: %s\", connectionUri.split(\":\")[1]);\n      }\n      return Collections.emptySet();\n    }\n  }\n\n  public static Set<String> tryParsePostgresConnectionUri(String connectionUri)\n      throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException\n  {\n    Class<?> driverClass = Class.forName(POSTGRES_DRIVER);\n    Method parseUrl = driverClass.getMethod(\"parseURL\", String.class, Properties.class);\n    Properties properties = (Properties) parseUrl.invoke(null, connectionUri, null);\n    if (properties == null) {\n      throw new IAE(\"Invalid URL format for PostgreSQL: [%s]\", connectionUri);\n    }\n    Set<String> keys = Sets.newHashSetWithExpectedSize(properties.size());\n    properties.forEach((k, v) -> keys.add((String) k));\n    return keys;\n  }","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/utils/ConnectionUriUtils.java#L162-L198","documentation":"tryParseJdbcUriParameters only knows how to parse mysql: and postgresql: JDBC schemes. For any other scheme (e.g. jdbc:h2:, jdbc:oracle:) it throws this IllegalArgumentException with the offending scheme, unless the caller set allowUnknown=true, in which case it returns an empty set.","triggerScenarios":"Calling tryParseJdbcUriParameters with a URI whose second token (uri.split(\":\")[1]) is a scheme other than mysql or postgresql, with allowUnknown=false. Malformed URIs without a second colon-separated token can also produce a confusing scheme value here.","commonSituations":"Metadata storage configured for h2 or another DB while utility code assumes mysql/postgres, typo'd JDBC URIs (jdbc:postgres: instead of jdbc:postgresql:), or custom storage extensions the parser doesn't support.","solutions":["Only call tryParseJdbcUriParameters for mysql/postgresql URIs, or pass allowUnknown=true if an empty parameter set is acceptable.","Fix the JDBC URI scheme typo (jdbc:postgresql:... for Postgres).","Add explicit handling/whitelisting for your custom scheme before invoking the parser.","Validate the URI scheme before parsing: check uri.startsWith(\"jdbc:mysql:\") || uri.startsWith(\"jdbc:postgresql:\")."],"exampleFix":"// before\nSet<String> params = ConnectionUriUtils.tryParseJdbcUriParameters(\"jdbc:h2:mem:test\", false);\n// after\nif (uri.startsWith(\"jdbc:mysql:\") || uri.startsWith(\"jdbc:postgresql:\")) {\n  Set<String> params = ConnectionUriUtils.tryParseJdbcUriParameters(uri, false);\n} else {\n  Set<String> params = Collections.emptySet();\n}","handlingStrategy":"validation","validationCode":"static boolean isSupportedJdbcScheme(String uri) {\n  return uri != null && uri.startsWith(\"jdbc:\")\n      && (uri.startsWith(\"jdbc:mysql:\") || uri.startsWith(\"jdbc:postgresql:\"));\n}","typeGuard":"static String extractScheme(String uri) {\n  String[] parts = uri.split(\":\");\n  return parts.length > 1 ? parts[1] : null;\n}","tryCatchPattern":"try {\n  params = ConnectionUriUtils.tryParseJdbcUriParameters(uri, false);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unknown JDBC connection scheme\")) {\n    // unsupported scheme: fall back to empty params or route elsewhere\n    params = Collections.emptySet();\n  } else {\n    throw e;\n  }\n}","preventionTips":["Check the URI scheme before parsing; only mysql/postgresql are supported","Fix common typos (jdbc:postgres: -> jdbc:postgresql:)","Pass allowUnknown=true if unknown schemes should yield empty parameter sets","Validate configured metadata-storage URIs at startup"],"tags":["jdbc","url","validation"],"backgroundTag":"invalid-url-format","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"}