| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
The Hive JDBC driver provides a mechanism to move data from one database format to another. Installing a JDBC client requires you to download the JDBC driver and install the client software correctly. You can use the Hive JDBC driver to connect to a SQL client. An example of connecting to the SQuirrel SQL client follows.
To download JDBC drivers
Download Hive 0.5 JDBC drivers from http://aws.amazon.com/developertools/Elastic-MapReduce/0196055244487017 and save the files locally.
Download Hive 0.7 JDBC drivers from http://aws.amazon.com/developertools/Elastic-MapReduce/1818074809286277 and save the files locally.
Download Hive 0.7.1 JDBC drivers from http://aws.amazon.com/developertools/Elastic-MapReduce/8084613472207189 and save the files locally.
Download Hive 0.8.1 JDBC drivers from http://aws.amazon.com/developertools/4897392426085727 and save the files locally.
You need only download the drivers appropriate to the version(s) of Hive you want to access.
To install SQuirrel SQL client
Download SQuirrel SQL client from http://squirrel-sql.sourceforge.net/.
Open the self extracting JAR file, and follow the wizard instructions to install the software.
From the command line, create an SSH tunnel to the master node of your Hive job flow as follows:
| If you are installing... | Enter the following... |
|---|---|
| Hive 0.5 drivers |
ssh -o ServerAliveInterval=10 -L 10000:localhost:10000
hadoop@
|
| Hive 0.7 drivers |
ssh -o ServerAliveInterval=10 -L 10001:localhost:10001
hadoop@
|
| Hive 0.7.1 drivers |
ssh -o ServerAliveInterval=10 -L 10002:localhost:10002
hadoop@
|
| Hive 0.8.1 drivers |
ssh -o ServerAliveInterval=10 -L 10003:localhost:10003
hadoop@
|
The MasterNodeDNS is the public DNS name of the master node of the
Hadoop cluster and mysecretkey.pem is the name of your AWS
secret key file.
Add the JDBC driver to SQuirrel SQL:
Open SQuirrel SQL and click the Drivers tab.
Double-click JDBC ODBC Bridge to add attributes.
Type org.apache.hadoop.hive.jdbc.HiveDriver in the
Class Name field, and then click
Add.
Navigate to the location of your JDBC drivers.
Add the following JAR files:
| If you are installing... | Add the following... |
|---|---|
| Hive 0.5 drivers |
hadoop-0.20-core.jar hive/lib/hive-exec-0.5.0.jar hive/lib/hive-jdbc-0.5.0.jar hive/lib/hive-metastore-0.5.0.jar hive/lib/hive-service-0.5.0.jar hive/lib/libfb303.jar hive/lib/log4j-1.2.15.jar lib/commons-logging-1.0.4.jar |
| Hive 0.7 drivers |
hadoop-0.20-core.jar hive/lib/hive-exec-0.7.0.jar hive/lib/hive-jdbc-0.7.0.jar hive/lib/hive-metastore-0.7.0.jar hive/lib/hive-service-0.7.0.jar hive/lib/libfb303.jar lib/commons-logging-1.0.4.jar slf4j-api-1.5.6.jar slf4j-log4j12-1.5.6.jar |
| Hive 0.7.1 drivers |
hadoop-0.20-core.jar hive/lib/hive-exec-0.7.1.jar hive/lib/hive-jdbc-0.7.1.jar hive/lib/hive-metastore-0.7.1.jar hive/lib/hive-service-0.7.1.jar hive/lib/libfb303.jar lib/commons-logging-1.0.4.jar slf4j-api-1.6.1.jar slf4j-log4j12-1.6.1.jar |
| Hive 0.8.1 drivers |
hadoop-0.20-core.jar hive/lib/hive-exec-0.8.1.jar hive/lib/hive-jdbc-0.8.1.jar hive/lib/hive-metastore-0.8.1.jar hive/lib/hive-service-0.8.1.jar hive/lib/libfb303.jar lib/commons-logging-1.0.4.jar slf4j-api-1.6.1.jar slf4j-log4j12-1.6.1.jar |
Click OK.
Add a new alias:
Click the Alias tab, and then click + to add a new alias.
Enter the following information in the Add Alias dialog:
| Field | Description |
|---|---|
| Name | Enter the name of the alias. |
| Driver | Select the JDBC driver from the list. |
| User Name | Enter your local machine login. |
| Password | Enter your local machine password. |
Enter the URL information in the Add Alias dialog based on the version of Hive:
| If you are installing... | Enter the following... |
|---|---|
| Hive 0.5 drivers |
jdbc:hive://localhost:10000/default
|
| Hive 0.7 drivers |
jdbc:hive://localhost:10001/default
|
| Hive 0.7.1 drivers |
jdbc:hive://localhost:10002/default
|
| Hive 0.8.1 drivers |
jdbc:hive://localhost:10003/default
|
Click OK.
The SQuirrel SQL client is ready to use.
For more information about using Hive and the JDBC interface, go to http://wiki.apache.org/hadoop/Hive/HiveClient and http://wiki.apache.org/hadoop/Hive/HiveJDBCInterface.