Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I execute Sqoop in Java?
    primarykey
    data
    text
    <p>I created a new Java project, then I added Library Sqoop and Hadoop. (The Libraries are "hadoop-core-1.1.1.jar, sqoop-1.4.2.jar, etc.... ".)</p> <p>Then I tried below code:</p> <pre><code>public class MySqoopDriver { public static void main(String[] args) { String[] str = { "export", "--connect", "jdbc:mysql://localhost/mytestdb", "--hadoop-home", "/home/yoonhok/development/hadoop-1.1.1", "--table", "tbl_1", "--export-dir", "hdfs://localhost:9000/user/hive/warehouse/tbl_1", "--username", "yoonhok", "--password", "1234"}; Sqoop.runTool(str); } } </code></pre> <p>The parameters are right, since when I try in terminal, it works well.</p> <p>But it didn't work. The error message is:</p> <pre><code>13/02/17 16:23:07 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead. 13/02/17 16:23:07 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset. 13/02/17 16:23:07 INFO tool.CodeGenTool: Beginning code generation 13/02/17 16:23:07 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `tbl_1` AS t LIMIT 1 13/02/17 16:23:07 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `tbl_1` AS t LIMIT 1 13/02/17 16:23:07 INFO orm.CompilationManager: HADOOP_HOME is /home/yoonhok/development/hadoop-1.1.1 Note: /tmp/sqoop-yoonhok/compile/86a3cab62184ad50a3ae11e7cb0e4f4d/tbl_1.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 13/02/17 16:23:08 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-yoonhok/compile/86a3cab62184ad50a3ae11e7cb0e4f4d/tbl_1.jar 13/02/17 16:23:08 INFO mapreduce.ExportJobBase: Beginning export of tbl_1 13/02/17 16:23:09 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 13/02/17 16:23:09 INFO input.FileInputFormat: Total input paths to process : 1 13/02/17 16:23:09 INFO input.FileInputFormat: Total input paths to process : 1 13/02/17 16:23:09 INFO mapred.JobClient: Cleaning up the staging area file:/tmp/hadoop-yoonhok/mapred/staging/yoonhok1526809600/.staging/job_local_0001 13/02/17 16:23:09 ERROR security.UserGroupInformation: PriviledgedActionException as:yoonhok cause:java.io.FileNotFoundException: File /user/hive/warehouse/tbl_1/000000_0 does not exist. 13/02/17 16:23:09 ERROR tool.ExportTool: Encountered IOException running export job: java.io.FileNotFoundException: File /user/hive/warehouse/tbl_1/000000_0 does not exist. </code></pre> <p>When I check the HDFS, the file exists:</p> <pre><code>hadoop fs -ls /user/hive/warehouse/tbl_1 Found 1 items -rw-r--r-- 1 yoonhok supergroup 240 2013-02-16 18:56 /user/hive/warehouse/tbl_1/000000_0 </code></pre> <p>How can I execute Sqoop in my Java program?</p> <p>I tried Processbuilder and Process, but I don't want to use them.</p> <p>I really want to use the Sqoop API, but I heard that it doesn't exist yet.</p> <p>I read <a href="https://stackoverflow.com/questions/9229611/how-to-use-sqoop-in-java-program">this question</a> but it doesn't work for me.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload