Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is Apache Hive JDBC driver for download? [closed]

Tags:

java

jdbc

hive

I need to connect to Hive from Java program via JDBC. I searched google and found numerous guides and examples like this: HiveServer2 clients

However, I could not find the JDBC driver itself (jar file) anywhere. There seem to be a jar file for download from Cloudera, but it requires registration.

Does anyone know where to get the plain Apache Hive JDBC driver itself ?

like image 625
user1021712 Avatar asked Mar 15 '16 07:03

user1021712


3 Answers

Using the Apache driver is fine if your program runs on a host with all the Hadoop libs already installed. Otherwise you will have to drag a smorgasbord of dependencies i.e.

  • hive-jdbc*-standalone.jar (the large one)
  • hadoop-common*.jar
  • hadoop-auth*.jar (for Kerberos only)
  • commons-configuration*.jar
  • the SLF4J family and friends

Packaging all these dependencies in your own JAR will probably result in a massive, cluttered piece of shoftware (God, how Maven is misused nowadays). Plus, you may have compatibility issue because newer clients are not compatible with older servers. "Not compatible" meaning "unable to initialize connection with Thrift server".

For a standalone install the Cloudera driver may be a good solution - registration just means leaving one of your "junk" e-mails to get a couple of marketing messages (and you can un-subscribe then). Although I admit I've never used it on a non-Cloudera cluster.

like image 182
Samson Scharfrichter Avatar answered Oct 17 '22 22:10

Samson Scharfrichter


Add this dependency to your Maven pom:

<dependency>
    <groupId>org.apache.hive</groupId>
    <artifactId>hive-jdbc</artifactId>
    <version>2.0.0</version>
</dependency>

The jar can be downloaded from: http://central.maven.org/maven2/org/apache/hive/hive-jdbc/2.0.0/hive-jdbc-2.0.0.jar

Complete list of versions: http://www.mvnrepository.com/artifact/org.apache.hive/hive-jdbc

like image 36
Boris Pavlović Avatar answered Oct 17 '22 20:10

Boris Pavlović


You can download an uber jar here:

https://github.com/timveil/hive-jdbc-uber-jar/releases

Works straightaway.

like image 2
Thomas Decaux Avatar answered Oct 17 '22 22:10

Thomas Decaux