Back

Sqoop

Note: Centos6.4 mysql java connector does not work. Update mysql-connector-java.jar located in /usr/share/java.
Download from http://dev.mysql.com/downloads/connector/j/

Import the 'salaries' table from the mysql 'test' db into /home/root/

sqoop import --connect jdbc:mysql://node1/test --table salaries --username root --fetch-size 1

Export the contents of /usr/root/salarydata/ into 'salaries2' table in the 'test' mysql db. Use ',' delimited.

sqoop export --connect jdbc:mysql://node1/test --table salaries2 --export-dir salarydata --input-fields-terminated-by "," --username root