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.?