How to run a Sqoop Import from a Hive Thrift Clien

2019-05-23 09:47发布

问题:

Using JDBC I easily connected and able to Run Hive-QL query with the following sample code:-

Connection con = DriverManager.getConnection("jdbc:hive2://192.168.56.102:10000/default", "", "");
Statement stmt = con.createStatement();
String tableName = "testHiveDriverTable1";
stmt.executeQuery("create table " + tableName + " (key int, value string)");

This means I am able to communicate with Hive. Now I want to execute sqoop also. How can I do it? I did it through command line, see following sample import which worked

sqoop import --connect jdbc:mysql://192.168.56.101:3316/dw_db --username=user --password=pwd --table active_list --hive-import -m 1 -- --schema default

how this can be achive. And to make sure is that server running at 10000 port is Hive thrift Server? If yes so how can I make it to execute my sqoop query over Hive?