Search code examples
hadoophivesqoopsqoop2sql-manager

sqoop to import data to hive


i am trying to import data to hive table using sqoop2. I am using --hive-import but it is not working

Code:

sqoop import --connect jdbc:sqlserver://192.168.x.xxx:11xx --username user --password user --table xxxx.NOTIFICATION --hive-import

Error:

ERROR manager.SqlManager: Error executing statement: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'XXXX.NOTIFICATION'.

What am I doing wrong?


Solution

  • Hi after doing a bit research and discussing on the question with @dev i found the solution.

    I am using sqoop2 so i changed my command and used below one and it worked for me.

    $ sqoop import --connect "jdbc:sqlserver://192.168.x.xxx:11xx;database=SSSS;username=user;password=user" --query "SELECT * FROM xxxx.NOTIFICATION where \$CONDITIONS" --split-by xxxx.NOTIFICATION.ID --hive-import --hive-table NOTIFICATION  --target-dir NOTIFICATION 
    

    before executing this command we should create table in hive using create command. Here i have created hive table named NOTIFICATION.