2015-01-28

Acquiring JAR files to access Hive server from SQurirrel SQL Client, using Maven's dependency plugin

Hive support JDBC interface, so we can utilize JDBC based SQL client programs such as SQurirrel SQL Client, Eclipse DTD(Data Tools Platform), DBViewer(Eclipse plugin), or even Oracle SQL Developer, to access and execute statements on Hive.

The following wiki page explains that step by step in case of SQurirrel SQL Client

Hive Wiki/HiveServer2 Clients/Integration with SQuirrel SQL Client

Unlike Oracle, MySQL or other most of databases, Hive JDBC driver is not distributed as a self-contained archive, which means lots of other JAR files are necessary to use it.
Above page doesn't explain exactly what files are necessary. And more, explained way to get those JAR files seems not convenient.

The following article kindly explains exact file set in case of Hive 0.10 but doesn't show how to get those files.

Connect to HiveServer2 with a kerberized JDBC client (Squirrel)

Using Maven's dependency plugin, we can download those necessary JAR files in convenient way.

In case of Hive 0.13,x, following JAR files are necessary to use JDBC connectivity.

  • commons-configuration-1.10.jar (Apache Commons Configuration)
  • commons-logging-1.2.jar (Apache Commons Logging)
  • guava-17.0.jar (Google Guava)
  • hadoop-auth-2.4.1.jar
  • hadoop-common-2.4.1.jar
  • hadoop-hdfs-2.4.1.jar
  • hadoop-mapreduce-client-core-2.4.1.jar
  • hive-common-0.13.1.jar
  • hive-exec-0.13.1.jar
  • hive-jdbc-0.13.1.jar
  • hive-metastore-0.13.1.jar
  • hive-service-0.13.1.jar
  • hive-shims-0.13.1.jar
  • libfb303-0.9.1.jar
  • libthrift-0.9.1.jar
  • httpcore-4.3.3.jar (Apache HttpComponents Core)
  • httpclient-4.3.6.jar (Apache HttpComponents Client)
  • log4j-1.2.17.jar (Apache Log4j)
  • slf4j-api-1.7.6.jar (SLF4J API)
  • slf4j-log4j12-1.7.6.jar (SLF4J Log4j Adapter)

The following shell script can be used anywhere just with Maven to get above files.
get goal of dependency plugin can be executed without pom file, so you just need the following script.
The local location to save the downloaded files can be specified by the value of -Ddest option of the mvn command-line in the script.

For Windows, you can use the following batch script.

References

0 comments:

Post a Comment