I’m following the hive JDBC tutorial. I could not get it working. When it try to get the connection it just hangs. It does not report any error either. I’m sure the Hive server is running. Any help?
public class HiveJdbcClient {
private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver";
public static void main(String[] args){
try {
Class.forName(driverName);
} catch (ClassNotFoundException e) {
e.printStackTrace();
System.exit(1);
}
try{
Connection con = DriverManager.getConnection("jdbc:hive://localhost:10000/default", "", "");
System.out.println("got the connection");
}catch(SQLException e){
e.printStackTrace();
}
}
}
output of the netstat:
$ sudo netstat -anlp | grep 10000
Password:
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 27738/java
tcp 107 0 127.0.0.1:10000 127.0.0.1:45910 ESTABLISHED 27738/java
tcp 0 0 127.0.0.1:33665 127.0.0.1:10000 ESTABLISHED 24475/java
tcp 0 0 127.0.0.1:45910 127.0.0.1:10000 ESTABLISHED 7445/java
tcp 107 0 127.0.0.1:10000 127.0.0.1:33665 ESTABLISHED 27738/java
Naresh: Try stopping the triffserver, then move to the HIVE_HOME/bin directory from your terminal, then start the hive trift server using the ./hive –service hiveserver 10000 & command. Then try running the program. Do a create table as per the hive client wiki example . Then do a show tables query in the next step. Let us know the result once this steps are followed. We can have a discussion after that.