Question

Hive JDBC: connection issue - Invalid status 21

  • 9 January 2023
  • 3 replies
  • 258 views

Badge

I am trying to set up a hive connection and have followed the instructions in the docs.

The issue is an error being thrown with a cryptic meaning

Could not open client transport with JDBC...Invalid status 21

Has anyone seen this before and have any pointers.  I've tried using generic jdbc driver and the one that shipped with HIVE

Trying to find a JAVA plugin for reader named `APACHE_HIVE'
Hive Reader: Preloading JDBC Driver Class 'org.apache.hive.jdbc.HiveDriver'
Hive Reader: Creating connection using connection string 'jdbc:hive2://x.y.z.a:10000:' and properties '{user=XXXXXXXX, password=************}'
 Hive Reader: Driver class 'org.apache.hive.jdbc.HiveDriver' is being loaded from '/C:/Users/XXXXXXXX/Documents/FME/Plugins/Java/hive-jdbc-3.1.3-standalone.jar'
java.sql.SQLException: Could not open client transport with JDBC Uri: jdbc:hive2://x.y.z.a:10000: Invalid status 21
  at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:256)
  at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:107)
  at COM.safe.fme.jdbc.JdbcCommon.openConnection(JdbcCommon.java:575)
  at COM.safe.fme.jdbc.JdbcReader.openHelper(JdbcReader.java:198)
at COM.safe.fme.jdbc.JdbcReader.open(JdbcReader.java:167)
Caused by: org.apache.hive.org.apache.thrift.transport.TTransportException: Invalid status 21

Thanks

Using FME desktop 2022.2


3 replies

Badge +11

Hi @Elpone,

I suspect this is cert/security related. Since this is Java you'll need to import the certificate into the Java cacerts file.

For FME Server... instructions are found here: https://docs.safe.com/fme/html/FME_Server_Documentation/AdminGuide/Import_CA_Certificate_for_SSL_Connections.htm

This will help you import the certificate into the cacerts file using Keytool command.

For Desktop

The files are located at C:\\<FME Install Folder>\\jre\\lib\\security and you can use the instructions for FME Server (keytool command) to do the same for FME Desktop. If this doesn't work... let me know and likely open a case.

I am working with another customer at this moment with the same issue where JDBC is missing the cert, but ODBC is working for them.

As a test, you can try the ODBC approach where the SSL options allow you to point to a PEM file (with the cert)... ( don't have details on the drivers you need to install for HIVE ODBC - that you'll have to configure first to test this).

 

ODBC SSL Options

Badge

Hi @steveatsafe​ 

We ended up using microsoft ODBC driver for hive and creating a DSN to connect into hive via an ODBC connector. As I understand it the jdbc driver does not work with kerberos according to this and this and adding this support has been proposed as an idea here.

I raised this with our vendor and afaik there is no change in this situation.

However as the ODBC connection will do what we need we will go down that road instead of using JDBC.

Badge +11

Hi @elpone​ ,

Thanks very much for that update! You guys work fast! Glad you got somewhere. I'll see if there is any update to share on the Kerberos support and update here if applicable.

Reply