How to Connect to AS400 DB2 via Sqoop and Import the data into HDFS or Hive

Hi,

Today i got a requirement of importing the AS400 DB2 data into HDFS or in Hive tables.

Please download the jt400.jar and place it in /usr/lib/sqoop/lib directory in the Hadoop Box.

Then I used the below SQoop script to import into Hive.

sqoop import \
–driver com.ibm.as400.access.AS400JDBCDriver \
–connect jdbc:as400://as400servername/dbname \
–username xxxxxxxx –password xxxxxxxx \
–query ‘SELECT * FROM <table_name> where $CONDITIONS’ \
–hive-import \
–hive-table table_name \
–target-dir /user/hdfs/example \
–fields-terminated-by ’01’ \
–split-by <id> \
-m 4;

Advertisements

3 thoughts on “How to Connect to AS400 DB2 via Sqoop and Import the data into HDFS or Hive

    • Is there anyway we can export data from AS400 to HDFS ? How can we do that ?
      We wanted to push files from AS400 to HDFS and not pull data in HDFS from AS400 ?

      Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s