Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7440073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:47:47+00:00 2026-05-29T10:47:47+00:00

I know how to use sqoop through command line. But dont know how to

  • 0

I know how to use sqoop through command line.
But dont know how to call sqoop command using java programs .
Can anyone give some code view?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:47:48+00:00Added an answer on May 29, 2026 at 10:47 am

    You can run sqoop from inside your java code by including the sqoop jar in your classpath and calling the Sqoop.runTool() method. You would have to create the required parameters to sqoop programmatically as if it were the command line (e.g. --connect etc.).

    Please pay attention to the following:

    • Make sure that the sqoop tool name (e.g. import/export etc.) is the first parameter.
    • Pay attention to classpath ordering – The execution might fail because sqoop requires version X of a library and you use a different version. Ensure that the libraries that sqoop requires are not overshadowed by your own dependencies. I’ve encountered such a problem with commons-io (sqoop requires v1.4) and had a NoSuchMethod exception since I was using commons-io v1.2.
    • Each argument needs to be on a separate array element. For example, “–connect jdbc:mysql:…” should be passed as two separate elements in the array, not one.
    • The sqoop parser knows how to accept double-quoted parameters, so use double quotes if you need to (I suggest always). The only exception is the fields-delimited-by parameter which expects a single char, so don’t double-quote it.
    • I’d suggest splitting the command-line-arguments creation logic and the actual execution so your logic can be tested properly without actually running the tool.
    • It would be better to use the –hadoop-home parameter, in order to prevent dependency on the environment.
    • The advantage of Sqoop.runTool() as opposed to Sqoop.Main() is the fact that runTool() return the error code of the execution.

    Hope that helps.

    final int ret = Sqoop.runTool(new String[] { ... });
    if (ret != 0) {
      throw new RuntimeException("Sqoop failed - return code " + Integer.toString(ret));
    }
    

    RL

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know can use string.find() to find a substring in a string. But what
I know use System.exit(0) can end a java program, for instance, if I have
I know use AJAX to periodically poll server for the command can achieve this,
I know I use the asp FileUpload control for uploading a file but I
I know you use the C based networking API to do FTP communication but
I know and use eric meyer CSS reset, but is there any more things
I know how to use JSON to create objects, but there doesn't seem to
I know you can use C++ keyword 'explicit' for constructors of classes to prevent
Can I use Linq-to-xml to persist my object state without having to use/know Xpath
I am new to jQuery . I know the use of jQuery but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.