mszurap commented on code in PR #5701:
URL: https://github.com/apache/hive/pull/5701#discussion_r2307080759


##########
beeline/src/java/org/apache/hive/beeline/BeeLine.java:
##########
@@ -900,6 +900,8 @@ private boolean connectUsingArgs(BeelineParser 
beelineParser, CommandLine cl) {
     getOpts().setScriptFile(cl.getOptionValue("f"));
 
     if (url != null) {
+      //remove white spaces in the URL in case there is any, like in 
"jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS_LIST=..."

Review Comment:
   For the reference, from a lab cluster, the connection fails if there is any 
space in the URL:
   ```
   beeline -u 'jdbc:hive2://zk1:2181,zk2:2181,zk3:2181/default;password=hive 
with 
spaces;serviceDiscoveryMode=zooKeeper;user=hive;zooKeeperNamespace=hiveserver2' 
--verbose
   ...
   !connect jdbc:hive2://zk1:2181,zk2:2181,zk3:2181/default;password=hive with 
spaces;serviceDiscoveryMode=zooKeeper;user=hive;zooKeeperNamespace=hiveserver2 
hive [passwd stripped]
   Connecting to jdbc:hive2://zk1:2181,zk2:2181,zk3:2181/default;password=hive
   java.lang.ClassNotFoundException: hive
           at 
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
   ...
           at 
org.apache.hive.beeline.BeeLine.execCommandWithPrefix(BeeLine.java:1463)
           at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:1502)
           at org.apache.hive.beeline.BeeLine.connectUsingArgs(BeeLine.java:922)
           at org.apache.hive.beeline.BeeLine.initArgs(BeeLine.java:804)
           at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:1115)
           at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:1089)
           at 
org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:547)
           at org.apache.hive.beeline.BeeLine.main(BeeLine.java:529)
   ...
   0: jdbc:hive2://hs2 (closed)> Connection is already closed.
   ```
   In this example, as previously explained, the username "hive" became the 
driver class name due to the skew in the arguments.
   The fact that there are spaces in the URL immediately caused the problem 
with our customer too, this is the primary reason for this fix too. We cannot 
have spaces anywhere, not even in the passwords. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to