SQuirreL as Hive Client with the JDBC Driver

By Dirk deRoos

SQuirreL SQL is an open source tool that acts as a Hive client. You can download this universal SQL client from the SourceForge website. It provides a user interface to Hive and simplifies the tasks of querying large tables and analyzing data with Apache Hive.

The figure illustrates how the Hive architecture would work when using tools such as SQuirreL.

image0.jpg

You can see that the SQuirreL client uses the JDBC APIs to pass commands to the Hive Driver by way of the Server.

Follow these steps to get SQuirreL running:

  1. Start the Hive Thrift Server using the command lsiting:

    $ $HIVE_HOME/bin/hive --service hiveserver -p 10000 -v
    Starting Hive Thrift Server
    Starting Hive Thrift Server on port 10000 with 100 min worker threads and 2147483647 max worker threads
  2. Download the latest SQuirreL distribution from the SourceForge site into a directory of your choice.

  3. Uncompress the SQuirreL package using the gunzip command and expand the archive using the tar command.

    gunzip squirrel-sql-3.5.0-standard.tar.gz; tar xvf squirrel-sql-3.5.0-standard.tar.gz
  4. Change to the new SQuirreL release directory and start the tool using the following command.

    $ cd squirrel-sql-3.5.0-standard;./squirrel-sql.sh

    Note that the instructions for including the Hadoop core .jar file may differ depending on the Hadoop release. In this case, the Hadoop .jar file was named hadoop-core-1.2.1.jar, so including $HADOOP_HOME/hadoop-*-core.jar per the online instructions was incorrect.

This is all that’s required to begin using the SQuirreL graphical user interface. The following figure shows some HiveQL commands running against the Hive Driver — similar to the commands you ran earlier, with the CLI.

image1.jpg

The Apache Hive 0.11 release also includes a new Hive Thrift Server called HiveServer2. When configured correctly, HiveServer2 can support multiple clients (a CLI client and a SQuirreL client at the same time, for example) and it provides better security.