Support Questions

Find answers, ask questions, and share your expertise

Question about beeline connection using spark-hive client

avatar
Rising Star

Hi,

I have a cluster with ranger enabled and trying to connect to hive using hive-spark beeline

Command:

/usr/hdp/current/spark2-client/bin/beeline -n testuser1 -p testuser1 -u "jdbc:hive2://<host:<port>/;principal=hive/_HOST@EXAMPLE.COM"

Output:

Connecting to jdbc:hive2://<host>:<port>/;principal=hive/_HOST@EXAMPLE.COM
INFO Utils: Supplied authorities: <host>:<port>
INFO Utils: Resolved authority: <host>:<port>
WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
INFO HiveConnection: Will try to open client transport with JDBC Uri: jdbc:hive2://<host>:<port>/;principal=hive/_HOST@EXAMPLE.COM
Error: Error while compiling statement: FAILED: HiveAccessControlException Permission denied: user [testuser1] does not have [USE] privilege on [Unknown resource!!] (state=42000,code=40000)
Beeline version 1.2.1.spark2.hdp.1 by Apache Hive
0: jdbc:hive2://<host>- (closed)> 

The same works fine for HSI client

/usr/hdp/current/hive-client/bin/beeline -n testuser1 -p testuser1 -u "jdbc:hive2://<host>:<port>;principal=hive/_HOST@EXAMPLE.COM"

Connecting to jdbc:hive2://<host>:<port>;principal=hive/_HOST@EXAMPLE.COM
Connected to: Apache Hive (version 2.1.0.2.6.1.0-111)
Driver: Hive JDBC (version 1.2.1000.2.6.1.0-111)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.2.1000.2.6.1.0-111 by Apache Hive
0: jdbc:hive2://<host>->  

Could someone help with identifying the reason for failure for hive-spark beeline.

It says the user doesnot have use privilege on unknown resource.

Thanks

1 ACCEPTED SOLUTION

avatar
Contributor

In case of spark-hive client, if no database is specified in the connection url, it uses default db and tries to use that, since there is no policy configured for default db it fails. So, create a Ranger policy for default db granting access, whereas in case of HSI client the connection doesn't use any database.

View solution in original post

2 REPLIES 2

avatar
Contributor

In case of spark-hive client, if no database is specified in the connection url, it uses default db and tries to use that, since there is no policy configured for default db it fails. So, create a Ranger policy for default db granting access, whereas in case of HSI client the connection doesn't use any database.

avatar
Rising Star

Thanks Surya. It worked.