sqoop import command can't handle Oracle ANYDATA type

Symptom

If a table contains a column which is ANYDATA type (for example, column V_CL1), then executing the sqoop import command in sqoop would fail with the following error:

 

[ERROR]: org.apache.sqoop.orm.ClassWriter - Cannot resolve SQL type 2007
[ERROR]: org.apache.sqoop.orm.ClassWriter - No Java type for SQL type 2007 for column V_CL1

 

Solution

Add --map-column-java V_CL1=String to the command, for example:

 

sqoop import --connect 'jdbc:oracle:thin:@[ip]:[port]:[schema]' --username username --password password --query 'SELECT V_CL1 FROM db1 WHERE $CONDITIONS' --map-column-java V_CL1=String -m 1 --target-dir /user/cloudera/test
Version history
Revision #:
6 of 6
Last update:
‎10-31-2017 10:06 AM
Updated by: