Skip to main content
jayes
Silver ⭐️⭐️⭐️
November 18, 2024
Question

Hive beeline multiple queries not working in command line

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

ggangadharan
Gold ⭐️
Gold ⭐️
November 18, 2024

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.

Translate
jayes
jayesAuthor
Silver ⭐️⭐️⭐️
November 19, 2024

Hi @ggangadharan ,

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

Translate
ggangadharan
Gold ⭐️
Gold ⭐️
November 22, 2024

Ideally below should work. 

use default;show tables;

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

Translate