[ https://issues.apache.org/jira/browse/HIVE-22874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17035432#comment-17035432 ]
Naveen Gangam commented on HIVE-22874: -------------------------------------- [~ychena] Thank you for the quick review. This code has already removed the host:port and the database name from this URI. It only uses the pattern to parse the properties from the URL. {noformat} String authorityFromClientJdbcURL = getAuthorityFromJdbcURL(uri); if ((authorityFromClientJdbcURL == null) || (authorityFromClientJdbcURL.isEmpty())) { // Given uri of the form: // jdbc:hive2:///dbName;sess_var_list?hive_conf_list#hive_var_list connParams.setEmbeddedMode(true); } else { connParams.setSuppliedURLAuthority(authorityFromClientJdbcURL); uri = uri.replace(authorityFromClientJdbcURL, dummyAuthorityString); } // Now parse the connection uri with dummy authority URI jdbcURI = URI.create(uri.substring(URI_JDBC_PREFIX.length())); // key=value pattern Pattern pattern = Pattern.compile("([^;]*)=([^;]*)[;]?"); // dbname and session settings String sessVars = jdbcURI.getPath(); if ((sessVars != null) && !sessVars.isEmpty()) { String dbName = ""; // removing leading '/' returned by getPath() sessVars = sessVars.substring(1); if (!sessVars.contains(";")) { // only dbname is provided dbName = sessVars; } else { // we have dbname followed by session parameters dbName = sessVars.substring(0, sessVars.indexOf(';')); sessVars = sessVars.substring(sessVars.indexOf(';') + 1); if (sessVars != null) { {noformat} So from ur example, it would have stripped off "jdbc:hive2://localhost:10000/default;" and uses the pattern to parse just "user=test1;password=test1" part of it. Hope this helps. > Beeline unable to use credentials from URL. > ------------------------------------------- > > Key: HIVE-22874 > URL: https://issues.apache.org/jira/browse/HIVE-22874 > Project: Hive > Issue Type: Bug > Components: Beeline > Reporter: Naveen Gangam > Assignee: Naveen Gangam > Priority: Minor > Fix For: 4.0.0 > > Attachments: HIVE-22874.patch > > > Beeline is not using password value from the URL. > Using LDAP Auth in this case, so the failure is on connect. > bin/beeline -u > "jdbc:hive2://localhost:10000/default;user=test1;password=test1" > On the server side in LdapAuthenticator, the principals come out to (via a > special debug logging) > 2020-02-11T11:10:31,613 INFO [HiveServer2-Handler-Pool: Thread-67] > auth.LdapAuthenticationProviderImpl: Connecting to ldap as > user/password:test1:anonymous > This bug may have been introduced via > https://github.com/apache/hive/commit/749e831060381a8ae4775630efb72d5cd040652f > pass = "" ( an empty string on this line) > https://github.com/apache/hive/blob/master/beeline/src/java/org/apache/hive/beeline/BeeLine.java#L848 > but on this line of code, it checks to see it is null which will not be true > and hence it never picks up from the jdbc url > https://github.com/apache/hive/blob/master/beeline/src/java/org/apache/hive/beeline/BeeLine.java#L900 > It has another chance here but pass != null will always be true and never > goes into the else condition. > https://github.com/apache/hive/blob/master/beeline/src/java/org/apache/hive/beeline/BeeLine.java#L909 -- This message was sent by Atlassian Jira (v8.3.4#803005)