What is "java.sql.SQLException: org.apache.thrift.transport.TTransportException" in Hive?

0 votes

I'm trying to create a table in hive using java. The code has thrown an exception while execution.

java.sql.SQLException: org.apache.thrift.transport.TTransportException

My code is:

public void createTable(String tableName) {
        try{
            Statement stat = con.createStatement();

        String QueryString = "CREATE TABLE '"+tableName+"'(User_Id INTEGER NOT NULL AUTO_INCREMENT, " + "User_Name VARCHAR(25), UserId VARCHAR(20), User_Pwd VARCHAR(15), primary key(User_Id))";

        a = stat.executeUpdate(QueryString);
        if(a==1){
            System.out.println(a);
            System.out.println("Table has been created");
        }

        }catch(Exception e){
        System.out.println(e);}
} 

What is the reason behind this exception?

How can I fix it.?

Jul 30 in Big Data Hadoop by nitinrawat895
• 10,710 points
248 views

1 answer to this question.

0 votes

This particular exception is related to Hive logs. It says that there are some issues and you are expected to go through your Hive logs Stack where you will find out the exact core reason or error in the log file.

The most common issues are as follows: 

  1. Issues with meta store related to concurrency

  2. When you start hive server as $hive --service yourhiveserver and keep it running for days and then run your code, it is possible that your connection is the broker to the server and you will get exact same error. If you reconnect to the server and this error will go away. This is only because after some time wait_time expired and disconnect happens.

  3. Port specific errors

Be sure to set up an open Port for your Hive Server and set it as below before starting hive server:

 $export HIVE_PORT=10000
 $hive --service hiveserver
 $ _run_your_code

There might other possibilities as well. I suggest you look into the Hive Logs.

I hope this helps. Happy Learning...;-)

answered Jul 30 by ravikiran
• 4,560 points

Related Questions In Big Data Hadoop

0 votes
1 answer

What is thrift in Hive?

Hey, Thrift comes in the architectural part of ...READ MORE

answered May 13 in Big Data Hadoop by Gitika
• 25,340 points
220 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

What is SerDe in Hadoop Hive?

The SerDe interface allows you to instruct ...READ MORE

answered Nov 20, 2018 in Big Data Hadoop by Akshay
669 views
0 votes
1 answer

What is Metastore in Hive?

It stores metadata for Hive tables (like their schema ...READ MORE

answered Dec 20, 2018 in Big Data Hadoop by Frankie
• 9,810 points
173 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,710 points
3,321 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,710 points
397 views
0 votes
10 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
16,371 views
0 votes
1 answer

What is the use of Apache Kafka in a Big Data Cluster?

Kafka is a Distributed Messaging System which ...READ MORE

answered Jun 21 in Big Data Hadoop by ravikiran
• 4,560 points
26 views
0 votes
1 answer

What is Kafka? what is its importance in Big-Data?

Apache Kafka is a tool used in ...READ MORE

answered Apr 11 in Big Data Hadoop by ravikiran
• 4,560 points
67 views