Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Query on Hive Commands / Beeline

avatar
Rising Star

Further to my earlier question (https://community.hortonworks.com/questions/64438/hive-beeline-e-in-shell-script.html#comment-64493)

Wondering how to use the commands beeline -e and beeline -f in shell scripts (bash shell). When I tried running beeline -e command directly on the bash, it says connection not available. So I presume we need to run beeline -u command or a combination of beeline;!connect commands together. But once we execute either of these commands, we will be in beeline shell rather than bash shell and hence beeline -e command is not needed anymore. So wondering what is the purpose of beeline -e command and how to use it without invoking beeline -u command earlier.

I am sure my understanding is wrong somewhere and hence would request to please correct me.

2 REPLIES 2

avatar
Master Guru

I use -u and -e

here is example

[hive@sunman1 ~]$ beeline -u jdbc:hive2://localhost:10000 -n hive -e 'show tables'
Connecting to jdbc:hive2://localhost:10000
Connected to: Apache Hive (version 1.2.1000.2.5.0.0-1245)
Driver: Hive JDBC (version 1.2.1000.2.5.0.0-1245)
Transaction isolation: TRANSACTION_REPEATABLE_READ
+-----------+--+
| tab_name  |
+-----------+--+
| airline1  |
+-----------+--+
1 row selected (0.215 seconds)
Beeline version 1.2.1000.2.5.0.0-1245 by Apache Hive
Closing: 0: jdbc:hive2://localhost:10000
[hive@sunman1 ~]$

avatar

Hi @sunile.manjee

I see you mention hive2 in connection but it says connected to Connected to: Apache Hive (version 1.2...)

How can we connect to Hive-2.1.*