Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!
Labels (1)
avatar
Super Guru

while running the sqoop command from the java program with -verbose option can result into race condition during obtaining lock on the console appender.we can workaround this with the help of SSHXCUTE framework which will create java program and sqoop command context separately.

ENV: HDP 2.4

Java Version : JDK-8

Step 1: download sshxcute jar from https://sourceforge.net/projects/sshxcute/

Step 2: Create RunSqoopCommand.java

import net.neoremind.sshxcute.core.SSHExec;
import net.neoremind.sshxcute.core.ConnBean;
import net.neoremind.sshxcute.task.CustomTask;
import net.neoremind.sshxcute.task.impl.ExecCommand;


public class RunSqoopCommand {


public static void main(String args[]) throws Exception{




    ConnBean cb = new ConnBean("localhost", "root","hadoop");


    SSHExec ssh = SSHExec.getInstance(cb);          
    ssh.connect();
    CustomTask sqoopCommand = new ExecCommand("sqoop import -Dorg.apache.sqoop.splitter.allow_text_splitter=true  
                                              -Dmapred.job.name=test --connect jdbc:oracle:thin:@10.0.2.12:1521:XE 
                                              --table TEST_INCREMENTAL -m 1 --username system 
                                              --password oracle --target-dir 
                                              /tmp/test26 
                                              --verbose");
    ssh.exec(sqoopCommand);
    ssh.disconnect();   
}
}

Step 3: compile program

javac -cp sshxcute-1.0.jar RunSqoopCommand.java

Step 4: Run program

java -cp sshxcute-1.0.jar RunSqoopCommand

2,106 Views
Version history
Last update:
‎12-20-2016 02:19 PM
Updated by:
Contributors