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?
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.
before executing this command we should create table in hive using
create
command. Here i have created hive table namedNOTIFICATION
.Below observations are based on Sqoop 1.4.6
you are using . (dot) in your table name.
Internally, Sqoop will fire command
to fetch metadata of your SQL Server table.
This command is interpreted as
To avoid this you can use escape character ( [ ] in case of SQL Server):
sqoop import --connect jdbc:sqlserver://192.168.x.xxx:11xx --username user --password user --table [xxxx.NOTIFICATION] --hive-import
This will generate
Now
xxxx.NOTIFICATION
will be treated as table name.I assume the table name is NOTIFICATION and you are trying to mention database name xxxx when you write --table xxxx.NOTIFICATION
If this is the case, can you please try the below mentioned syntax instead?