从SybaseIQ到Hive的Sqoop导入 - java.io.IOException:nextKeyValue

时间:2017-03-08 10:23:33

标签: hadoop jdbc sqoop sybase-iq

当我尝试将表格导入Hive时,我收到一个奇怪的错误。

查询:

sqoop import  --connect 'jdbc:sybase:Tds:10.100.*.***:5500/DATABASE=****' --driver 'com.sybase.jdbc3.jdbc.SybDriver' --username "****" --password "***" --table dw.dm_court_courttype --direct -m 1 --hive-import --create-hive-table --hive-table DM_court_courtcype --target-dir "/user/hive/warehouse/DM_Court_CourtType" --verbose

错误:

  

java.io.IOException:nextKeyValue中的SQLException                   at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:277)                   at org.apache.hadoop.mapred.MapTask $ NewTrackingRecordReader.nextKeyValue(MapTask.java:565)                   at org.apache.hadoop.mapreduce.task.MapContextImpl.nextKeyValue(MapContextImpl.java:80)                   at org.apache.hadoop.mapreduce.lib.map.WrappedMapper $ Context.nextKeyValue(WrappedMapper.java:91)                   在org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)                   在org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)                   在org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:796)                   在org.apache.hadoop.mapred.MapTask.run(MapTask.java:346)                   在org.apache.hadoop.mapred.YarnChild $ 2.run(YarnChild.java:163)                   at java.security.AccessController.doPrivileged(Native Method)                   在javax.security.auth.Subject.doAs(Subject.java:415)                   在org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1595)                   在org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)           引起:com.sybase.jdbc3.jdbc.SybSQLException:SQL Anywhere错误-131:'。'附近的语法错误在第1行                   在com.sybase.jdbc3.tds.Tds.a(未知来源)                   在com.sybase.jdbc3.tds.Tds.nextResult(未知来源)                   在com.sybase.jdbc3.tds.Tds.getResultSetResult(未知来源)                   在com.sybase.jdbc3.tds.TdsCursor.open(未知来源)                   在com.sybase.jdbc3.jdbc.SybStatement.executeQuery(未知来源)                   在com.sybase.jdbc3.jdbc.SybPreparedStatement.executeQuery(未知来源)                   在org.apache.sqoop.mapreduce.db.DBRecordReader.executeQuery(DBRecordReader.java:111)                   在org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:235)                   ......还有12个

1 个答案:

答案 0 :(得分:1)

不要将数据库名称与表名一起使用。

使用--table dm_court_courttype代替 --table dw.dm_court_courttype

试试这个:

sqoop import --connect 'jdbc:sybase:Tds:10.100..:5500/DATABASE=****' --driver 'com.sybase.jdbc3.jdbc.SybDriver' --username "****" --password "*" --table dm_court_courttype --direct -m 1 --hive-import --create-hive-table --hive-table DM_court_courtcype --target-dir "/user/hive/warehouse/DM_Court_CourtType" --verbose