Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to Do I get the Hive JDBC Driver for My Client

Solved Go to solution

How to Do I get the Hive JDBC Driver for My Client

I would like to use SquirrelSQL or Oracle SQL Developer or another SQL tool to connect to Hive via JDBC. Where do I find the Hive JDBC Client?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to Do I get the Hive JDBC Driver for My Client

@dstreever@hortonworks.com has a nice write up on this, including a script that pulls together the needed jars, on his wiki at https://streever.atlassian.net/wiki/x/DABD.

6 REPLIES 6

Re: How to Do I get the Hive JDBC Driver for My Client

FOR HDP 2.2.x From /usr/hdp/current/hive-client/lib/ sftp or scp to your local desktop

  • hive-*-0.14*.jar
  • httpclient-4.2.5.jar
  • httpcore-4.2.5.jar
  • libthrift-0.9.0.jar
  • libfb303-0.9.0.jar
  • commons-logging-1.1.3.jar

FOR HDP 2.3.x

From /usr/hdp/current/hive-client/lib/ sftp or scp to your local desktop

  • hive-jdbc.jar

FOR BOTH

From /usr/hdp/current/hadoop-client

  • hadoop-common.jar
  • hadoop-auth.jar

From /usr/hdp/current/hadoop-client/lib

  • log4j-1.2.17.jar
  • slf4j-*.jar

Download SquirrelSQL from sourceforge.net

http://squirrel-sql.sourceforge.net/

Configure Hive Driver in Squirrel SQL

  1. Select ‘Drivers -> New Driver…’ to register the Hive JDBC driver.
  2. Enter Hive for Driver Name and jdbc:// Example URL: jdbc:hive://localhost:10000/default
  3. Select ‘Extra Class Path -> Add’ to add the jars you copied from the previous steps.
  4. Enter org.apache.hive.jdbc.HiveDriver as Class Name

Add a New Hive Connection Alias for HDP 2.3

  1. Choose Alias -> New Alias
  2. Enter “Hive for HDP 2.3”
  3. Enter “jdbc:hive2://1270.0.1:10000”
  4. Enter “hive” for User Name and “hive” for Password.
  5. Test your connection and ensure it is successful
  6. Connect to “Hive for HDP 2.3.” alias. If successful you would be presented with the default and xademo databases.

Oracle SQL Developer and Toad for Apache Hadoop does not use Apache Hive JDBC Driver. They are both black boxes that hide the the ability to easily point to a JDBC class path and just end whatever JDBC properties you desire.

So if you need to add special properties for ssl, or kerberos or ldap authentication, neither SQL Developer nor Toad will work.

Use SQL Workbench J, RazorSQL or Squirrel SQL instead.

Re: How to Do I get the Hive JDBC Driver for My Client

@dstreever@hortonworks.com has a nice write up on this, including a script that pulls together the needed jars, on his wiki at https://streever.atlassian.net/wiki/x/DABD.

Re: How to Do I get the Hive JDBC Driver for My Client

I have tested this and this is the best/easy way to configure the connection

2189-screen-shot-2016-02-16-at-34215-pm.png

2190-screen-shot-2016-02-16-at-34347-pm.png

Highlighted

Re: How to Do I get the Hive JDBC Driver for My Client

Contributor

Starting with Hive 0.14, there is a standalone jar that contains most of the necessary binaries. It still currently requires two additional jars until HIVE-9600 is resolved:

  • hive-jdbc-<version>-standalone.jar
  • hadoop-common.jar
  • hadoop-auth.jar

See http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.0/bk_dataintegration/content/hive-jdbc-odbc-dr... for details.

Re: How to Do I get the Hive JDBC Driver for My Client

New Contributor

I have HDP 2.3 sandbox in my server, I followed you instruction to setup the connection for squirrel sql, I got under exception:

java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:206) at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.awaitConnection(OpenConnectionCommand.java:132) at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$100(OpenConnectionCommand.java:45) at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$2.run(OpenConnectionCommand.java:115) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(OpenConnectionCommand.java:175) at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$000(OpenConnectionCommand.java:45) at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$1.run(OpenConnectionCommand.java:104) ... 5 more Caused by: java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration at org.apache.hive.jdbc.HiveConnection.createUnderlyingTransport(HiveConnection.java:418) at org.apache.hive.jdbc.HiveConnection.createBinaryTransport(HiveConnection.java:438) at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:179) at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:152) at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:107) at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:133) at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(OpenConnectionCommand.java:167) ... 7 more Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.conf.Configuration at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 14 more

can you please help?

Thanks

Re: How to Do I get the Hive JDBC Driver for My Client

New Contributor

@Ancil McBarnett check out the repo i've been maintianing that uses maven to pull the required jars.

https://community.hortonworks.com/repos/33592/hive-jdbc-uber-jar.html