Hi  All ,
 
I've got some problem in programming hive-hbase client,  could someone help
me?
 
 
The code is very simple, select some data from a hbase-based   table.
 
 
 public static void main(String[] args) throws SQLException {
 
  try {
   Class.forName(driverName);
  } catch (ClassNotFoundException e) {
   // System.out.println(e);
   e.printStackTrace();
   System.exit(1);
  }
 
  Connection con = DriverManager.getConnection(
    "jdbc:hive://2.1.37.110:10000/default", "", "");
  Statement stmt = con.createStatement();
  String tableName = "hive_zsf11";
 
  String sql = "select * from " + tableName + " where id = 1";
  System.out.println("Running: " + sql);
  ResultSet res = stmt.executeQuery(sql);
  while (res.next()) {
   System.out.println(String.valueOf(res.getInt(1)) + "\t"
     + res.getString(2));
  }
 }
}

error info is below:
Hive history
file=/tmp/z00100568/hive_job_log_z00100568_201006171106_406425331.txt
10/06/17 11:06:20 INFO exec.HiveHistory: Hive history
file=/tmp/z00100568/hive_job_log_z00100568_201006171106_406425331.txt
Running: select * from hive_zsf11 where id = 1 Exception in thread "main"
java.sql.SQLException: Query returned non-zero code: 9, cause: FAILED:
Execution Error, return code 2 from
org.apache.hadoop.hive.ql.exec.ExecDriver
 at
org.apache.hadoop.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:19
7)
 at com.huawei.hive.HiveJdbcClient.main(HiveJdbcClient.java:69)
 
Before doing this, I have build the hive-hbase integration code
successfully, and can run SQL to operate hbase-based table well on the
shell.
So, what's more need to do? Thanks a lot.
 
Best Regards,
Zhou
----------------------------------------------------------------------------
---------------------------------------------------------
This e-mail and its attachments contain confidential information from
HUAWEI, which is intended only for the person or entity whose address is
listed above. Any use of the information contained herein in any way
(including, but not limited to, total or partial disclosure, reproduction,
or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please
notify the sender by phone or email immediately and delete it!



Reply via email to