Support Questions

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

Connect hive with zookeeper in java

avatar
Contributor

String url = "jdbc:hive2://huge-agent02:10000/";

Class.forName(driverName);

conn =(Connection) DriverManager.getConnection(url, "hive", "hive");

when i replace url to zookeeper url (jdbc:hive2://huge-server:2181,huge-agent02:2181,huge-agent01:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2), it can not connected hive,why?

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Ye Jun

Are you passing the driverName as "org.apache.hive.jdbc.HiveDriver" ?

Also when you say with the mentioned url it can not connect .... does it mean that you are getting any error? Or is it getting hung for a long time?

Are the host names resolvable from the host where you are running the code?

Example: (from Client machine)

# telnet huge-server  2181
# telnet huge-agent02  2181
# telnet huge-agent01 2181

.

View solution in original post

10 REPLIES 10

avatar
Explorer

@Jay SenSharma, can you tell the exact version where this issue was fixed i am currently using 2.4.0.0-169, when if i use 1.2.1000.2.5.0.0-1245, i am getting other errors like hiveserver2 not starting or some zookeeper error. is this https://issues.apache.org/jira/browse/HIVE-11581