1

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?

Community
  • 1
  • 1
Arjun C S
  • 11
  • 1
  • 3

1 Answers1

3

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
ravi
  • 1,078
  • 2
  • 17
  • 31
  • now we are getting the error: Exception in thread "main" java.lang.NoSuchFieldError: INSTANCE at org.apache.http.conn.ssl.SSLConnectionSocketFactory.(SSLConnectionSocketFactory.java:144) at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:912) hive-site.xml partial content is: thrift://10.205.64.70:9083 Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore. – Arjun C S Feb 07 '17 at 05:43
  • Did you solve the problem? Also any error or code please update to your question not comment. It is hard to read in the comment. – ravi Feb 10 '17 at 18:29
  • There is a similar issue reported here: http://stackoverflow.com/questions/35868242/httpclient-main-java-lang-nosuchfielderror-instance-at-org-apache-http-conn-s – ravi Feb 10 '17 at 18:37
  • I did not get any solution so I am trying to use qubol jars to solve it if I am able to achieve I will update here – Arjun C S Feb 15 '17 at 11:33