Search code examples
sqoop

Error with sqoop import from mysql to hbase


I started learning sqoop recently with cloudera CDH5 VM.

I created mysql table from a CSV file having columns baseid, date, cars, kms.

  • Database used: mysql
  • Table created: uberdata

In hbase shell, I created with table name --myuberdatatable and column family --uber_details.

I checked with scan command and got to see empty table with 0 rows.

To Transfer the data from my mysql to hbase:

sqoop import jdbc:mysql://localhost/mysql --username root --password cloudera 
             --table uberdata --hbase-table myuberdatatable --column-family trip_details 
             --hbase-row-key base -m 1**

I am getting the following error:

Syntax error, unexpected tIdentifier

with a mark showing before jdbc.

It could be small error but tried to find solution in stackoverflow.

Can anyone help to fix this. Thanks in advance...


Solution

  • Yes, it is a syntax error. You have missed the connect keyword in the sqoop import statement.

    Please use this format.[tested]

    sqoop import --connect jdbc:mysql://localhost/emp --username root --password cloudera --table employee --hbase-table empdump --column-family emp_id --hbase-row-key id -m 1