Dbeaver Hive Kerberos



The CData JDBC Driver for Hive implements JDBC standards that enable third-party tools to interoperate, from wizards in IDEs to business intelligence tools. This article shows how to connect to Hive data with wizards in DBeaver and browse data in the DBeaver GUI.

Dbeaver Hive Kerberos

Complete Guide to Apache Hive, data warehouse Architecture and Components, Setting up Hive Connection with Kerberos authentication. Hive driver is part of DBeaver installation but it uses basic authentication with user name and password. Kerberos authentication is another option to connect to Hive. It can be accomplished by adding a new driver to DBeaver. The DBeaver driver is based on Cloudera JDBC Driver for Hive.

Create a JDBC Data Source for Hive Data

HiveHive

Using Kerberos authentication from Unix Machines on the same domain. This guide assumes a working Kerberos setup already exists. Run the following code on a Windows machine with working Kerberos authentication to verify if the aforementioned is true. The code will print 'Authentication Scheme: KERBEROS' to the console if successful. We would like to show you a description here but the site won’t allow us. The Kerberos realm on your environment is the same as the realm specified in the kdc.conf file from the Hive server. Check the Kerberos configuration (that is, krb5.conf) and validity of the principal and keytab pair using MIT Kerberos client: kinit -V -k -t.keytab KERBEROS.REALM.

Dbeaver Kerberos Hive Windows

Follow the steps below to load the driver JAR in DBeaver.

  1. Open the DBeaver application and, in the Databases menu, select the Driver Manager option. Click New to open the Create New Driver form.
  2. In the Driver Name box, enter a user-friendly name for the driver.
  3. To add the .jar, click Add File.
  4. In the create new driver dialog that appears, select the cdata.jdbc.apachehive.jar file, located in the lib subfolder of the installation directory.
  5. Click the Find Class button and select the ApacheHiveDriver class from the results. This will automatically fill the Class Name field at the top of the form. The class name for the driver is cdata.jdbc.apachehive.ApacheHiveDriver.
  6. Add jdbc:apachehive: in the URL Template field.

Create a Connection to Hive Data

Dbeaver Hive Kerberos

Follow the steps below to add credentials and other required connection properties.

  1. In the Databases menu, click New Connection.
  2. In the Create new connection wizard that results, select the driver.
  3. On the next page of the wizard, click the driver properties tab.
  4. Enter values for authentication credentials and other properties required to connect to Hive.

    Set the Server, Port, TransportMode, and AuthScheme connection properties to connect to Hive.

    Built-in Connection String Designer

    For assistance in constructing the JDBC URL, use the connection string designer built into the Hive JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.

    java -jar cdata.jdbc.apachehive.jar

    Fill in the connection properties and copy the connection string to the clipboard.

    Below is a typical connection string:

    jdbc:apachehive:Server=127.0.0.1;Port=10000;TransportMode=BINARY;

Query Hive Data

You can now query information from the tables exposed by the connection: Right-click a Table and then click Edit Table. The data is available on the Data tab.

There are many article has been shared about how to connect hive using dbeaver using kerberos authentication. This Link is one of those. Several people has report it, that they already succeed to made a connection to hive using dbeaver via mac or windows. It’s not surprising me in that moment since I have success story to connect hive using dbeaver in my mac mojave even I didn’t followed those steps.

But, after couple of week, I didn’t know what happened to my mac, the connection become broken and always generate this error message:

[Cloudera][HiveJDBCDriver](500168) Error creating login context using ticket cache: Unable to obtain Principal Name for authentication .
Unable to obtain Principal Name for authentication
Unable to obtain Principal Name for authentication

Dbeaver kerberos hive windows

So, I try to follow complete steps in several links that I already got from “googling” but the result is always failed. Again and again. I knew thats it’s not issue (bugs or mall function) in dbeaver, but jdbc is more take responsibility in this case since unable to read the ticket – even the ticket is already generated by kinit command.

Mar 11 16:32:14.288 TRACE 36 com.cloudera.hiveserver2.jdbc.kerberos.Kerberos.getSubjectViaAccessControlContext(): +++++ enter +++++
Mar 11 16:32:14.289 TRACE 36 com.cloudera.hiveserver2.jdbc.kerberos.Kerberos.getSubjectViaJAASConfig(): +++++ enter +++++
Mar 11 16:32:14.289 TRACE 36 com.cloudera.hiveserver2.jdbc.kerberos.Kerberos.getSubjectViaTicketCache(): +++++ enter +++++
Mar 11 16:32:14.456 ERROR 36 com.cloudera.hiveserver2.exceptions.ExceptionConverter.toSQLException: [Cloudera][HiveJDBCDriver](500168) Error creating login context using ticket cache: Unable to obtain Principal Name for authentication .

Maybe, there are special treatment or any special configuration in mojave to make kerberos ticket unable to read by jdbc. Does any one can help me? Pliiisss …