Unable to create JOB in SQOOP

Bala picture Bala · Jul 16, 2014 · Viewed 9.1k times · Source

I ran below snippet in SQOOP and ended up with error listed below the code.

bin/sqoop job --create myjob import --connect jdbc:mysql://localhost/test -username root -password root --table patient -m 1 --target-dir /Sqoop/MRJob

administrator@ubuntu:~/sqoop-1.4.4.bin__hadoop-1.0.0$ bin/sqoop job --create myjob import --connect jdbc:mysql://localhost/test -username root -password root --table patient -m 1 --target-dir /Sqoop/MRJob Warning: /usr/lib/hcatalog does not exist! HCatalog jobs will fail. Please set $HCAT_HOME to the root of your HCatalog installation. Warning: $HADOOP_HOME is deprecated.

14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Error parsing arguments for job: 14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Unrecognized argument: import 14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Unrecognized argument: --connect 14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Unrecognized argument: jdbc:mysql://localhost/test 14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Unrecognized argument: -username 14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Unrecognized argument: root 14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Unrecognized argument: -password 14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Unrecognized argument: root 14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Unrecognized argument: --table 14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Unrecognized argument: patient 14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Unrecognized argument: -m 14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Unrecognized argument: 1 14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Unrecognized argument: --target-dir 14/07/16 23:23:36 ERROR tool.BaseSqoopTool: Unrecognized argument: /Sqoop/MRJob

Try --help for usage instructions. usage: sqoop job [GENERIC-ARGS] [JOB-ARGS] [-- [] [TOOL-ARGS]]

Job management arguments: --create Create a new saved job --delete Delete a saved job --exec Run a saved job --help
Print usage instructions --list List saved jobs --meta-connect Specify JDBC connect string for the metastore --show Show the parameters for a saved job --verbose
Print more information while working

Generic Hadoop command-line arguments: (must preceed any tool-specific arguments) Generic options supported are -conf specify an application configuration file -D use value for given property -fs specify a namenode -jt specify a job tracker -files specify comma separated files to be copied to the map reduce cluster -libjars specify comma separated jar files to include in the classpath. -archives specify comma separated archives to be unarchived on the compute machines.

The general command line syntax is bin/hadoop command [genericOptions] [commandOptions]

Could some one help me on this??

Thanks in Advance for your help.

Note: My SQL related dictionaries are perfect. Regards

Answer

venBigData picture venBigData · Jul 16, 2014

There is a small change that you need to make in your sqoop command. The right syntax would be

bin/sqoop job --create myjob -- import --connect jdbc:mysql://localhost/test --username root --password root --table PATIENT -m 1 --target-dir /Sqoop/MRJob

[ Note: "--" and a space before the import. Secondly, use POSIX notation "--" before username and password. Thirdly use upper case to specify table name ] it should work.

Few standards: use Options file to store credentials (user name, password and connect string) and pass it as as a parameter to --options-file. Hope this helps.