3

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

Amal G Jose
  • 2,486
  • 1
  • 20
  • 35
Bala
  • 81
  • 1
  • 3
  • 7

3 Answers3

12

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.

venBigData
  • 600
  • 1
  • 8
  • 23
1

Try to write below command.

gopal@ubuntu:~$ `sqoop job --create JobName -- import --connect jdbc:mysql://localhost/DatabaseName --table tablename -m1 --target-dir /OutPutDirectoryName;`
Tunaki
  • 132,869
  • 46
  • 340
  • 423
0

It's better to set SQOOP_PATH in .bashrc and run

user@hostname:~$ gedit .bashrc

add following lines in .bashrc file

export SQOOP_HOME=/usr/lib/sqoop
export PATH=$PATH:$SQOOP_HOME/bin

Now, you can run sqoop job by

sqoop import --connect jdbc:mysql://localhost/test --username root --password root --table patient --m 1 --target-dir /Sqoop/MRJob
Y.Prithvi
  • 1,221
  • 3
  • 14
  • 27