Sqoop import all tables not syncing with hive database

hive
#1

Hi All,

I imported mysql database tables to hive using sqoop tool by using below script.

sqoop import-all-tables --connect “jdbc:mysql://quickstart.cloudera:3306/retail_db” --username=retail_dba --password=cloudera --hive-import --hive-overwrite --create-hive-table --warehouse-dir=/user/hive/warehouse/
but when i check the database in hive, there is no retail.db. Please help me on this.

Thanks & Regards,
Damodar Kumar G.

0 Likes

#2

You need to create the database first and then import the tables.

0 Likes

#3

I created database and ran below scripts

sqoop import-all-tables --connect “jdbc:mysql://quickstart.cloudera:3306/retail_db” --username=retail_dba --password=cloudera --hive-import --hive-overwrite --create-hive-table

but getting below error
16/12/23 23:34:25 ERROR hive.HiveConfig: Could not load org.apache.hadoop.hive.conf.HiveConf. Make sure HIVE_CONF_DIR is set correctly.
16/12/23 23:34:25 ERROR tool.ImportAllTablesTool: Encountered IOException running import job: java.io.IOException: java.lang.ClassNotFoundException: org.apache.hadoop.hive.conf.HiveConf

0 Likes

#4

@Damodar_Kumar If you are planning to import data into a specific hive table, you need to use --hive-database parameter.

here is an example

sqoop import-all-tables --connect “jdbc:mysql://quickstart.cloudera:3306/retail_db” --username=retail_dba --password=cloudera --hive-import --hive-overwrite --create-hive-table --hive-database sqoop_import

make sure sqoop_import DB is already created and is empty.

0 Likes