Support Questions

Find answers, ask questions, and share your expertise

Getting error Required field 'client_protocol' is unset! while connecting to hive database using hive-jdbc

avatar
Contributor

I have setup the HDP 2.6 cluster and primarily using the hive. Have created the hive database and hive tables. When I tried to connect to the hiveserver using hive-jdbc and seeing the above error. Tried to search google for help but no luck.

I am using the following jdbc driver:

http://repo.hortonworks.com/content/repositories/releases/org/apache/hive/hive-jdbc/2.1.0.2.6.2.0-20...

I was seeing this error while trying to connect from BI, and wrote a simple JDBC client code and seeing the same error from the this client code too..

Here is the exception stack trace from the client code.

org.apache.hive.org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{use:database=default})
    at org.apache.hive.org.apache.thrift.TApplicationException.read(TApplicationException.java:111) ~[hive-jdbc-2.1.0.2.6.2.0-205-standalone.jar:2.1.0.2.6.2.0-205]
    at org.apache.hive.org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:79) ~[hive-jdbc-2.1.0.2.6.2.0-205-standalone.jar:2.1.0.2.6.2.0-205]
    at org.apache.hive.service.rpc.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:168) ~[hive-jdbc-2.1.0.2.6.2.0-205-standalone.jar:2.1.0.2.6.2.0-205]
    at org.apache.hive.service.rpc.thrift.TCLIService$Client.OpenSession(TCLIService.java:155) ~[hive-jdbc-2.1.0.2.6.2.0-205-standalone.jar:2.1.0.2.6.2.0-205]
    at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:578) [hive-jdbc-2.1.0.2.6.2.0-205-standalone.jar:2.1.0.2.6.2.0-205]
    at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:188) [hive-jdbc-2.1.0.2.6.2.0-205-standalone.jar:2.1.0.2.6.2.0-205]
    at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:107) [hive-jdbc-2.1.0.2.6.2.0-205-standalone.jar:2.1.0.2.6.2.0-205]
    at java.sql.DriverManager.getConnection(DriverManager.java:664) [?:1.8.0_144]
    at java.sql.DriverManager.getConnection(DriverManager.java:270) [?:1.8.0_144]

Looks like

2 REPLIES 2

avatar
Expert Contributor

@Bala Kolla can you please update the query with jdbc connection string, issue might be with the connection string parameters or the second possible issue could be with version mismatch. can you use the hive-jdbc jar provided by HDP installable rather than donwloading from web ?

avatar
Contributor

Looks like this is something to do with the driver.. I am not seeing this error anymore once I switched the driver to

hive-jdbc-1.2.xxxx.

I am suspecting that cognos is not compatible with the hive-jdbc-2.x