Support Questions
Find answers, ask questions, and share your expertise

Hive 2 JDBC connection issue

New Contributor

I am on HDP 2.6.5.0-292. Trying to connect to Hive through Java JDBC.

I enabled Hive 2.x by following the instructions here https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.6.3/bk_hive-performance-tuning/content/ch_hive-...

Enabled Hive interactive queries and LLAP

I am having issues while connecting from a java program.

Connection to Hive could not be established using connection URL jdbc:hive2://xx.xx.xx.xxx:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2-hive2. Please confirm if the connection credentials are correct. Cause: Could not open client transport for any of the Server URI's in ZooKeeper: java.net.ConnectException: Operation timed out (Connection timed out). Cause: Could not open client transport for any of the Server URI's in ZooKeeper: java.net.ConnectException: Operation timed out (Connection timed out)

I can telnet into the server URIs. But, can't connect through Java JDBC.

I can connect through beeline as well.

Connected to: Apache Hive (version 2.1.0.2.6.5.0-292)	

Driver: Hive JDBC (version 1.2.1000.2.6.5.0-292)	

Any inputs while working with HIve 2.x configuration and execution would be appreciated.

Thanks

3 REPLIES 3

Hi @Atif Tahir!
Could you confirm if you are:
  • Able to telnet the zk hosts through the 2181 port
  • Connect to zk (using zookeeper-client) and list the HiveNamespace

Or try to run the command with (using hiveserver2 instead of hiveserver2-hive2):

jdbc:hive2://xx.xx.xx.xxx:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2

Hope this helps!

New Contributor

Thanks @Vinicius Higa Murakami for the response.

Will try the hiverserver2 part.
Yes, I can telnet and connect to zk hosts.

This is the output of connecting to zk (using zookeeper-client) and list the HiveNamespace

[zk: localhost:2181(CONNECTED) 0] ls /hiveserver2
[serverUri=ip-xx-xx-xx-xxx.us-west-1.compute.internal:10000;version=1.2.1000.2.6.5.0-292;sequence=0000000001]
[zk: localhost:2181(CONNECTED) 1] 

New Contributor

@Vinicius Higa Murakami

As you can see from the zk output is currently for Hive 1.2. Any suggestions to configure Zookeeper for Hive 2.x?

Any documentation links would be really helpful

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.