Reputation: 25
I have one table in the database where insertdate
is of 'Date' type. However, when I import the table into hive using sqoop values in hive tables are getting decremented.
Example
RDBMS --> insertdate='2013-04-01'
Hive --> insertdate='2013-03-30'
I have used below command to import data:
sqoop import --connect 'jdbc:sqlserver://localhost;username=XXXXX;password=XXXXXXX;database=XXXXXXXXXX'--table tbl_name \
--warehouse-dir /user/hive/warehouse --m 1 \
--hive-import --hive-database db_name --hive-overwrite --null-string '\\N' --null-non-string '\\N' --hive-drop-import-delims
Upvotes: 2
Views: 757
Reputation: 503
Solved in mysql by using parameter : -D mapreduce.map.java.opts=" -Duser.timezone=GMT"
sqoop import -D mapreduce.map.java.opts=" -Duser.timezone=GMT" \
--connect jdbc:mysql://hostname/location \
--username name -P \
--table VW_Location_History_For_Hadoop \
--target-dir /apps/hive/warehouse/test.db/location_h \
--hive-table test.location_hierarchy \
--fields-terminated-by "," \
--hive-import \
--delete-target-dir \
--m 1
Upvotes: 0
Reputation: 13753
The problem is not with Sqoop, it is with the JDBC driver of SQL Server.
Check related question - dates consistently two days off
I think you are putting sqljdbc4.jar
in /sqoop/lib
.
Use sqljdbc41.jar
or newer to fix this.
(sqljdbc41.jar
is compiled with Java 7)
Upvotes: 1