Getting error while running sqoop job

Hello Sir - When I ran the below command - i got the error

[balasnathan@gw03 ~]$ sqoop job > --create import_orders \ > --import \ > --connect jdbc:mysql://ms.itversity.com:3306/retail_export \ > --username retail_user \ > --password-file file:///home/balasnathan/password_file \ > --table orders \ > --warehouse-dir /user/balasnathan/sqoop_import/retail_db > --delete-target-dir19/10/09 11:34:14 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.6.5.0-29219/10/09 11:34:14 ERROR tool.BaseSqoopTool: Error parsing arguments for job:19/10/09 11:34:14 ERROR tool.BaseSqoopTool: Unrecognized argument: --import19/10/09 11:34:14 ERROR tool.BaseSqoopTool: Unrecognized argument: --connect19/10/09 11:34:14 ERROR tool.BaseSqoopTool: Unrecognized argument: jdbc:mysql://ms.itversity.com:3306/retail_export19/10/09 11:34:14 ERROR tool.BaseSqoopTool: Unrecognized argument: --username19/10/09 11:34:14 ERROR tool.BaseSqoopTool: Unrecognized argument: retail_user19/10/09 11:34:14 ERROR tool.BaseSqoopTool: Unrecognized argument: --password-file19/10/09 11:34:14 ERROR tool.BaseSqoopTool: Unrecognized argument: file:///home/balasnathan/password_file19/10/09 11:34:14 ERROR tool.BaseSqoopTool: Unrecognized argument: --table19/10/09 11:34:14 ERROR tool.BaseSqoopTool: Unrecognized argument: orders19/10/09 11:34:14 ERROR tool.BaseSqoopTool: Unrecognized argument: --warehouse-dir19/10/09 11:34:14 ERROR tool.BaseSqoopTool: Unrecognized argument: /user/balasnathan/sqoop_import/retail_db19/10/09 11:34:14 ERROR tool.BaseSqoopTool: Unrecognized argument: --delete-target-dirTry --help for usage instructions.

while I ran t he below command, job completed successfully.

sqoop job > --create import_orders > – import > --connect jdbc:mysql://ms.itversity.com:3306/retail_export > --username retail_user > --password-file file:///home/balasnathan/password_file > --table orders > --warehouse-dir /user/balasnathan/sqoop_import/retail_db > --delete-target-dir

Difference between first and second command is space between – and Import. First command does not have whereas second command has.

Why is that the job is failing?

You can do it in the first command way as well. Please go through the below syntax you have give a space beteen -- & import as it a sub tool name.

sqoop job \
 --create import_orders \
 -- import \
 --connect jdbc:mysql://ms.itversity.com:3306/retail_db \
 --password-file file:///home/username/password_file \
 --table orders \
 --warehouse-dir /user/username/sqoop_import/retail_db \
 --delete-target-dir

Please go through the high level syntax which is mentioned in the sqoop documentation.