database - Run Sqoop command on Windows using jar -


i new hadoop hdfs , sqoop. installed hadoop hdfs on 1 machine single node. able put , file to/from hdfs repectively.

requirement [do not want install hadoop , sqoop on client machine]: want access hdfs differnt machine using webhdfs without installation of hadoop on client machine , part working fine.

to access hdff, using webhdfs java client jar. want execute export/import command of sqoop remote hdfs.

case: export local file system hadoop sqoop not installed, using haddop , sqoop client jar.

public int importtohdfs(string tablename, string stmppath){     int resultcode=-1;      try {         string s = file.separator;         string outdir = stmppath.substring(0,stmppath.lastindexof(s));         string[] str = {"import"                 , "--connect", jdbcurl                 ,"--table",tablename                 , "--username", susername, "--password", spassword                 , "-m", "1"                 ,"--target-dir","/tmp/user/hduser"                 ,"--outdir",outdir         };         configuration conf = new configuration();         resultcode = sqoop.runtool(str,conf);     }catch(exception ex){         system.out.print(ex.tostring());     }     return resultcode; } 


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -