Before any answer and comments. I tried several options that I found on Stackoverflow, but ended up crashing. Below are the links -
I tried it in Horton Sandbox through the command line and succeed.
sqoop import --connect jdbc: mysql: //192.168.56.101: 3316 / database_name --username = user --password = pwd --table table_name --hive-import -m 1 - --schema default
Where 192.168.56.101 for Windows and 192.168.56.102 for Horton Sandbox 2.6.
Now I want to do the same with Java, where this Java code runs somewhere else, but not in the horton sandbox.
- How to decompose the parameters of HIVE_HOME and other Sqoop, since they work in Sandbox.
- the options that I have to go through. It should be passed as SqoopOptions or Sqoop.runTools String Array Arguments. Both refused.
- I am also confused. For now, import the library (com.cloudera.sqoop and org.apache.sqoop) and get this
The execution of the method (com.cloudera.sqoop.SqoopOptions) in the ImportTool type is not applicable to arguments (org.apache.sqoop.SqoopOptions) with these two lines (the option parameter is added between these two lines)
SqoopOptions options = new SqoopOptions();
int ret = new ImportTool().run(options);
if I select the Cloudera method, it will become obsolete, but if I select the apace run method, it will not accept the options argument
It struck me for weeks. Please, help.