{"record":{"id":"3e43822e063506de","repo":"t8y2/dbx","slug":"hive-connection-string-must-start-with-jdbc-hive2-3e4382","errorCode":null,"errorMessage":"Hive connection string must start with jdbc:hive2:// or hive://","messagePattern":"Hive connection string must start with jdbc:hive2:// or hive://","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/hive-go/config.go","lineNumber":332,"sourceCode":"\t\t}\n\t\tport := defaultHivePort\n\t\tif parsedURL.Port() != \"\" {\n\t\t\tparsedPort, err := strconv.Atoi(parsedURL.Port())\n\t\t\tif err != nil {\n\t\t\t\treturn parsedHiveConnection{}, fmt.Errorf(\"invalid Hive port: %w\", err)\n\t\t\t}\n\t\t\tport = parsedPort\n\t\t}\n\t\tresult.endpoints = []endpoint{{Host: parsedURL.Hostname(), Port: port}}\n\t\tresult.database = strings.Trim(parsedURL.Path, \"/\")\n\t\tfor key, entries := range parsedURL.Query() {\n\t\t\tif len(entries) > 0 {\n\t\t\t\tsetCaseInsensitive(result.parameters, key, entries[len(entries)-1])\n\t\t\t}\n\t\t}\n\t\treturn result, nil\n\t} else {\n\t\treturn parsedHiveConnection{}, errors.New(\"Hive connection string must start with jdbc:hive2:// or hive://\")\n\t}\n\n\tresult := newParsedHiveConnection()\n\tif fragment := strings.IndexByte(value, '#'); fragment >= 0 {\n\t\tresult.hiveVars = parseHiveAssignments(value[fragment+1:], false)\n\t\tvalue = value[:fragment]\n\t}\n\tif query := strings.IndexByte(value, '?'); query >= 0 {\n\t\tresult.hiveConfs = parseHiveAssignments(value[query+1:], false)\n\t\tvalue = value[:query]\n\t}\n\tpathStart := strings.IndexByte(value, '/')\n\tauthority := value\n\tpathAndParams := \"\"\n\tif pathStart >= 0 {\n\t\tauthority = value[:pathStart]\n\t\tpathAndParams = value[pathStart+1:]\n\t}","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/hive-go/config.go#L314-L350","documentation":"The Hive driver parses connection strings and only accepts two schemes: jdbc:hive2:// and hive://. Any other prefix reaches the final else branch and is rejected. This prevents silently treating a malformed DSN as a host.","triggerScenarios":"Passing DSNs like 'hive2://host', 'jdbc:hive://host', 'http://host:10000', 'host:10000' (no scheme) or 'thrift://host' to the config parser.","commonSituations":"Migrating from tools that accept bare hostnames, mixing up hive2 vs jdbc:hive2, templated DSNs where the scheme placeholder wasn't substituted.","solutions":["Prefix the value with jdbc:hive2:// (the standard HiveServer2 JDBC form) or the shorthand hive://.","Strip any wrong scheme before passing (e.g. convert hive2://host to jdbc:hive2://host).","Validate the scheme in application code before handing the DSN to the driver."],"exampleFix":"// before\ndsn := \"hive2://hiveserver:10000/default\"\n// after\ndsn := \"jdbc:hive2://hiveserver:10000/default\"","handlingStrategy":"validation","validationCode":"func normalizeHiveDSN(v string) string {\n    switch {\n    case strings.HasPrefix(v, \"jdbc:hive2://\"), strings.HasPrefix(v, \"hive://\"):\n        return v\n    case strings.HasPrefix(v, \"hive2://\"):\n        return \"jdbc:\" + v\n    default:\n        return \"jdbc:hive2://\" + v\n    }\n}","typeGuard":"func isHiveDSN(v string) bool {\n    return strings.HasPrefix(v, \"jdbc:hive2://\") || strings.HasPrefix(v, \"hive://\")\n}","tryCatchPattern":null,"preventionTips":["Store full DSNs including scheme in config","Normalize legacy hive2:// DSNs at ingestion time","Add a unit test asserting DSN scheme before driver calls"],"tags":["hive","configuration","connection-string","url-parsing"],"backgroundTag":"invalid-connection-string","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}