Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Hive beeline multiple queries not working in command line

avatar
Rising Star

I am trying to run use db_name;show tables and it is failing. 
Can you please help me with it 

[root@cupid ~]# sudo -u hive beeline -u "jdbc:hive2://charon.devemc.com:2181,cupid.devemc.com:2181,portia.devemc.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;" --showHeader=false --outputformat=tsv2 --delimiter=';' -e "use default;show tables;"
scan complete in 2ms
Connecting to jdbc:hive2://charon.devemc.com:2181,cupid.devemc.com:2181,portia.commvault.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;
Connected to: Apache Hive (version 0.14.0.2.2.9.0-3393)
Driver: Hive JDBC (version 0.14.0.2.2.9.0-3393)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Error: Error while compiling statement: FAILED: ParseException line 1:11 missing EOF at ';' near 'default' (state=42000,code=40000)

3 REPLIES 3

avatar
Master Collaborator

The query seems to be failing during the compilation phase, indicating a possible issue with its syntax.

Error: Error while compiling statement: FAILED: ParseException line 1:11 missing EOF at ';' near 'default' (state=42000,code=40000)

It is important to validate the SQL syntax of the query to identify any potential syntax errors that may be causing the problem.
Another point to consider is ensuring that the column names in the query match with those in the source and target tables, as any mismatch can lead to errors.

avatar
Rising Star

Hi @ggangadharan ,

the query that i am running is "use <dbname>;show tables;"

avatar
Master Collaborator

Ideally below should work. 

use default;show tables;

Please check HiveServer2, HMS logs and share the stack-trace.  To identify the RootCause.