Arjun C S
Arjun C S

Reputation: 11

Unable to connect to hive server2 (SQL Exception, thrift transport exception and so on)

We tried to connect to hive server2 database using the JARs:

  1. hadoop-common-2.7.1.2.3.2.0-2950.jar
  2. hive-jdbc-1.2.1.2.3.2.0-2950-standalone.jar

We integrated those 2 jars into Eclipse project and the code to connect to hive database is:

Connection con=null;
    try {
        Class.forName("org.apache.hive.jdbc.HiveDriver");
        StringBuffer jdbcConnectionString = new StringBuffer();
        jdbcConnectionString.append("jdbc:hive2://10.205.64.70:10000/default");
        con = DriverManager.getConnection(jdbcConnectionString.toString(),"********","********");
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

but when we execute we are getting the error as below

java.sql.SQLException: Could not open client transport with JDBC Uri: jdbc:hive2://10.205.64.70:10002/imsone: Invalid status 72
Could not open client transport with JDBC Uri: jdbc:hive2://10.205.64.70:10002/imsone: Invalid status 72
    at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:209)
    at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:107)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at dummy.connectToHive.connect(connectToHive.java:40)
    at dummy.connectToHive.main(connectToHive.java:16)
Caused by: org.apache.thrift.transport.TTransportException: Invalid status 72
    at org.apache.thrift.transport.TSaslTransport.sendAndThrowMessage(TSaslTransport.java:232)
    at org.apache.thrift.transport.TSaslTransport.receiveSaslMessage(TSaslTransport.java:184)
    at org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:307)
    at org.apache.thrift.transport.TSaslClientTransport.open(TSaslClientTransport.java:37)
    at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:227)
    at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:182)
    ... 5 more

Can someone please help me to sort out the issue?

Upvotes: 1

Views: 10111

Answers (1)

ravi
ravi

Reputation: 1088

Error 72 is a bad url issue. Is your hive2 Server running in HTTP mode?

Connection URL When HiveServer2 Running in HTTP Mode is:-

jdbc:hive2://<host>:<port>/<db>;transportMode=http;httpPath=<http_endpoint>

where:- is the corresponding HTTP endpoint configured in hive-site.xml. Default value is cliservice.

Default port for HTTP transport mode is 10001.

Can you try below url:

jdbc:hive2://10.205.64.70:10001/default;transportMode=http;httpPath=cliservice

Upvotes: 3

Related Questions