Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Beeline TLS connection string with username and password

Solved Go to solution

Beeline TLS connection string with username and password

Explorer

Hello everyone,

 

I’m newer to Hive so I’m assuming that I’m doing something wrong. I’ve configured Hive to require LDAP BasedDN authentication (not AD) and configured TLS for HiveServer2.

 

With beeline I’m able to authenticate with an interactive user prompt. For example:

beeline> !connect jdbc:hive2://<serverName>:10000/default;ssl=true;sslTrustStore=<trustStorePath>.jks;trustStorePassword=<trustStorePassword>

Login with username and password:

Enter username for jdbc:hive2://…
Enter password for jdbc:hive2://…

What I would like to do is connect with username/password in the connection string. I see example to configure the connection string with TLS or username/password, but haven’t been able find an example of both. I’ve attempted combining settings and I’m doing something wrong.

 

This is an example of what I've attempted:

beeline -u jdbc:hive2://<serverName>:10000/default;ssl=true;sslTrustStore=<truststorePath>.jks;trustStorePassword=<trustStorePassword> -n User -w /home/User/passwordFile.txt

or

beeline -u jdbc:hive2://<serverName>:10000/default;ssl=true;sslTrustStore=<truststorePath>.jks;trustStorePassword=<trustStorePassword> -n User -p userPassword

Thanks for the help,

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Beeline TLS connection string with username and password

Guru
Hi Steve,

Have you tried below format:

jdbc:hive2://hs2node:10000/default;user=<userid>;password=<password>

together with other parameters?

Thanks
Eric
3 REPLIES 3
Highlighted

Re: Beeline TLS connection string with username and password

Guru
Hi Steve,

Have you tried below format:

jdbc:hive2://hs2node:10000/default;user=<userid>;password=<password>

together with other parameters?

Thanks
Eric

Re: Beeline TLS connection string with username and password

Explorer

Hi Eric,

 

Thanks for the suggestion, but it didn't work. Below is output from trying and it shows that I'm able to login when prompted.

 

[user@serverHostName ~]$ beeline -u jdbc:hive2://serverFQDN:10000/demo;ssl=true;sslTrustStore=/opt/jdk/hive.truststore.jks;trustStorePassword=trustPassword;user=testUser;password=testUserPassword
scan complete in 2ms
Connecting to jdbc:hive2://serverFQDN:10000/demo
Unknown HS2 problem when communicating with Thrift server.
Error: Could not open client transport with JDBC Uri: jdbc:hive2://serverFQDN:10000/demo: Invalid status 21 (state=08S01,code=0)
Beeline version 1.1.0-cdh5.14.4 by Apache Hive
beeline> !connect jdbc:hive2://serverFQDN:10000/demo;ssl=true;sslTrustStore=/opt/jdk/hive.truststore.jks;trustStorePassword=trustPassword
Connecting to jdbc:hive2://serverFQDN:10000/demo;ssl=true;sslTrustStore=/opt/jdk/hive.truststore.jks;trustStorePassword=trustPassword
Enter username for jdbc:hive2://serverFQDN:10000/demo;ssl=true;sslTrustStore=/opt/jdk/hive.truststore.jks;trustStorePassword=trustPassword: test_user
Enter password for jdbc:hive2://serverFQDN:10000/demo;ssl=true;sslTrustStore=/opt/jdk/hive.truststore.jks;trustStorePassword=trustPassword: ****************
Connected to: Apache Hive (version 1.1.0-cdh5.14.4)
Driver: Hive JDBC (version 1.1.0-cdh5.14.4)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://serverFQDN:10000/demo> show databases;
INFO  : Compiling command(queryId=hive_20190613081212_d18016a9-24a0-48b4-9023-783382566773): show databases
INFO  : Semantic Analysis Completed
INFO  : Returning Hive schema: Schema(fieldSchemas:[FieldSchema(name:database_name, type:string, comment:from deserializer)], properties:null)
INFO  : Completed compiling command(queryId=hive_20190613081212_d18016a9-24a0-48b4-9023-783382566773); Time taken: 0.669 seconds
INFO  : Concurrency mode is disabled, not creating a lock manager
INFO  : Executing command(queryId=hive_20190613081212_d18016a9-24a0-48b4-9023-783382566773): show databases
INFO  : Starting task [Stage-0:DDL] in serial mode
INFO  : Completed executing command(queryId=hive_20190613081212_d18016a9-24a0-48b4-9023-783382566773); Time taken: 0.299 seconds
INFO  : OK
+----------------+--+
| database_name  |
+----------------+--+
| default        |
| demo           |
+----------------+--+
2 rows selected (1.419 seconds)
0: jdbc:hive2://serverFQDN:10000/demo>

Re: Beeline TLS connection string with username and password

Explorer

Hi Eric,

 

The user= and password= parameters worked once I put the connection string in single quotes ' '. 

 

This is an example of what worked.

 

 

[user@serverHostName ~]$ beeline -u 'jdbc:hive2://serverFQDN:10000/demo;ssl=true;sslTrustStore=/opt/jdk/hive.truststore.jks;trustStorePassword=trustPassword;user=testUser;password=testUserPassword'

 

Double qoutes should work too.

 

 

Thanks for the help!