问题描述
我正在尝试使用lastq的Sqoop增量从DB2数据库导入表。该表具有Timestamp类型的列,这是im使用的检查列。我想先导入整个表,然后再导入任何最新的修改,因此我将last-value设置为0。下面是命令:
注意:updateTS列中的某些值为“ 1/1/0001 12:00:00”
sqoop import --connect "jdbc:db2*****************" --username **** --password ***** --driver com.ibm.db2.jcc.DB2Driver --table my_table --m 20 --split-by col1 --target-dir /user/employ/sqoop_dir --check-column updateTS --incremental lastmodified --last-value 0
执行上述命令时,出现以下错误
com.ibm.db2.jcc.am.sqlSyntaxErrorException: DB2 sql Error: sqlCODE=-104,sqlSTATE=42601,sqlERRMC=);<INTEGER>,DRIVER=4.17.29
at com.ibm.db2.jcc.am.hd.a(hd.java:747)
at com.ibm.db2.jcc.am.hd.a(hd.java:66)
at com.ibm.db2.jcc.am.hd.a(hd.java:135)
at com.ibm.db2.jcc.am.wo.c(wo.java:2771)
at com.ibm.db2.jcc.am.wo.d(wo.java:2759)
at com.ibm.db2.jcc.am.wo.a(wo.java:2192)
at com.ibm.db2.jcc.am.wo.a(wo.java:2168)
at com.ibm.db2.jcc.t4.ab.h(ab.java:136)
at com.ibm.db2.jcc.t4.ab.b(ab.java:41)
at com.ibm.db2.jcc.t4.o.a(o.java:32)
at com.ibm.db2.jcc.t4.tb.i(tb.java:145)
at com.ibm.db2.jcc.am.wo.kb(wo.java:2161)
at com.ibm.db2.jcc.am.wo.a(wo.java:3258)
at com.ibm.db2.jcc.am.wo.a(wo.java:697)
at com.ibm.db2.jcc.am.wo.executeQuery(wo.java:676)
at org.apache.sqoop.manager.sqlManager.getCurrentDbTimestamp(sqlManager.java:986)
at org.apache.sqoop.tool.ImportTool.initIncrementalConstraints(ImportTool.java:346)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:525)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:633)
at org.apache.sqoop.Sqoop.run(Sqoop.java:146)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:182)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:233)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:242)
at org.apache.sqoop.Sqoop.main(Sqoop.java:251)
20/09/16 23:52:02 ERROR manager.sqlManager: Chained exception 1:
com.ibm.db2.jcc.am.sqlException: DB2 sql Error: sqlCODE=-514,sqlSTATE=26501,sqlERRMC=sql_CURLH200C1,DRIVER=4.17.29
at com.ibm.db2.jcc.am.hd.a(hd.java:752)
at com.ibm.db2.jcc.am.hd.a(hd.java:66)
at com.ibm.db2.jcc.am.hd.a(hd.java:135)
at com.ibm.db2.jcc.am.wo.c(wo.java:2771)
at com.ibm.db2.jcc.am.wo.a(wo.java:2219)
at com.ibm.db2.jcc.t4.ab.o(ab.java:908)
at com.ibm.db2.jcc.t4.ab.j(ab.java:267)
at com.ibm.db2.jcc.t4.ab.d(ab.java:55)
at com.ibm.db2.jcc.t4.o.c(o.java:44)
at com.ibm.db2.jcc.t4.tb.j(tb.java:157)
at com.ibm.db2.jcc.am.wo.mb(wo.java:2214)
at com.ibm.db2.jcc.am.wo.a(wo.java:3261)
at com.ibm.db2.jcc.am.wo.a(wo.java:697)
at com.ibm.db2.jcc.am.wo.executeQuery(wo.java:676)
at org.apache.sqoop.manager.sqlManager.getCurrentDbTimestamp(sqlManager.java:986)
at org.apache.sqoop.tool.ImportTool.initIncrementalConstraints(ImportTool.java:346)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:525)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:633)
at org.apache.sqoop.Sqoop.run(Sqoop.java:146)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:182)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:233)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:242)
at org.apache.sqoop.Sqoop.main(Sqoop.java:251)
20/09/16 23:52:02 ERROR tool.ImportTool: Import Failed: java.io.IOException: Could not get current
time from database
at org.apache.sqoop.tool.ImportTool.initIncrementalConstraints(ImportTool.java:348)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:525)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:633)
at org.apache.sqoop.Sqoop.run(Sqoop.java:146)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:182)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:233)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:242)
at org.apache.sqoop.Sqoop.main(Sqoop.java:251)
如果我只是简单地导入而没有增量lastmodified条件,则导入成功。
sqoop import --connect "jdbc:db2*****************" --username **** --password ***** --driver com.ibm.db2.jcc.DB2Driver --table my_table --m 20 --split-by col1 --target-dir /user/employ/sqoop_dir
但是,现在格式为20/22/2002的updateTS列现在转换为纪元时间戳。
我该如何解决这两个问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)