Connect to Hortonworks Hive
This article describes how to connect to a Hive database on Hortonworks clusters from ONE Desktop.
The connection is established via a custom JDBC driver and lets you browse Hive tables from the IDE using the SQL interface. You can connect in two ways: using the Apache Knox gateway or using a direct connection with optional Kerberos authentication.
Connect to Hive via Knox
To set up a connection to Hive on clusters that use Apache Knox Gateway, follow these steps.
Make sure the Hive Server is running and HTTP(S) mode is enabled. |
Import truststore
By default, the Apache Hive Knox JDBC URL contains sslTrustStore
and trustStorePassword
values.
As ONE Desktop does not support JDBC URL encryption, the credentials would be visible in an exported runtime configuration file.
To prevent this, the Apache Hive Knox driver in ONE Desktop is preconfigured without sslTrustStore
and trustStorePassword
and you have to import these parameters to the Java truststore file: <JAVA_HOME>/lib/security/cacerts
.
Install Apache Hive standalone driver
-
Place the
hive-jdbc-<version>-standalone.jar
and related libraries to the<ATACCAMA_HOME>/lib/jdbc/hive-knox
folder on your local machine. The libraries should be provided by your Hadoop admin. -
Start ONE Desktop.
-
Go to Window > Preferences > [your product] > Database.
-
From the list of preconfigured drivers, double-click Apache Hive Knox.
-
Select Add to Classpath and locate the libraries added in step 1.
-
Remove the libraries that are not in the
<ATACCAMA_HOME>/lib/jdbc/hive-knox
folder from the classpath. -
Select OK to finish.
The driver now has a green dot and YES in the Configured column of the table.
For the general installation procedure and information about working with databases in ONE Desktop, see Databases. |
Connect to Hive via Knox
Create a new database connection according to the standard procedure (see Databases, section Connect to a database) with the following specifications:
-
Database type: Select Apache Hive Knox.
-
Connection parameters: Configure driver-specific connection parameters:
-
Gateway host: Specifies the name or IP of the gateway host.
-
Gateway port: Gateway port.
-
Gateway path: Gateway path.
-
Cluster name: Cluster name.
-
Username: Knox username.
-
Password: Knox password.
-
Connect directly to Hive
Follow these steps to set up a direct connection to Hive.
Configure Kerberos authentication (Kerberos only)
If Kerberos is enabled on the cluster, follow the steps in this section.
Make sure that your Windows machine is connected to the Kerberos server.
Otherwise, copy the krb5.conf file from the /etc folder on the Hadoop cluster to <ATACCAMA_HOME>/jre/lib/security on your machine.
|
Create a Kerberos ticket
The Hive JDBC driver requires an open Kerberos ticket to be available at the credential store as it cannot work directly with the Kerberos keytab.
To create the Kerberos ticket using the kinit
application, navigate to <ATACCAMA_HOME>/jre/bin
and run the kinit
command in Java:
-
If you have user and password authentication against Kerberos enabled, get the ticket directly from KDC:
.\kinit.exe -f username@DOMAIN.COM
-
If you need to use the keytab:
.\kinit.exe -f -k -t <path_to_keytab> username@DOMAIN.COM
Turn off javax.security.auth.useSubjectCredsOnly
The Hortonworks Apache Hive driver does not pick up Kerberos tickets automatically.
To enable obtaining credentials from the Kerberos tickets, add the Java option -Djavax.security.auth.useSubjectCredsOnly=false
to the following locations:
-
one-ide.ini
(ordqc.ini
, depending on your product). -
Java options of any plan using JDBC Reader or SQL Select steps while running against Hive.
Install Apache Hive standalone driver
-
Place the
hive-jdbc-<version>-standalone.jar
and related libraries to the`<ATACCAMA_HOME>/lib/jdbc/hdp-hive` folder on your local machine. The libraries should be provided by your Hadoop admin. -
Start ONE Desktop.
-
Go to Window > Preferences > [your product] > Database.
-
To add a new database driver, select Add and provide the name of the new database (Apache Hive).
-
Select Add to Classpath and locate the libraries added in step 1.
-
Select OK to finish.
The driver now has a green dot and YES in the Configured column of the table.
For the general installation procedure and information about working with databases in ONE Desktop, see Databases. |
Create a database connection to Hive
Create a new database connection according to the standard procedure (see Databases, section Connect to a database) with the following specifications:
-
Database type: Select Apache Hive.
-
Connection parameters > By URL > Connection string: The connection string should be provided by your Hadoop admin.
Connection string examplesjdbc:hive2://myhost.example.com:10001/default;principal=hive/myhost.example.com@EXAMPLE.COM;transportMode=http;httpPath=cliservice;auth=kerberos jdbc:hive2://myhost.example.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
For more information about Hive JDBC connection and drivers, see Hive JDBC and ODBC Drivers. |
Was this page useful?