我使用sqoop用updateonly选项更新oracle中的一个表。我试过很多网站上提到的建议,但仍然不起作用。
代码如下所示。。。
SqoopOptions sqoopClient = new SqoopOptions();
sqoopClient.setFieldsTerminatedBy(fieldDelim);
sqoopClient.setLinesTerminatedBy(lineTerminator);
sqoopClient.setTableName(tableName);
sqoopClient.setColumns(columnArray);
//columnArray contains the list of columns to update including the update
sqoopClient.setUpdateKeyCol("id");
sqoopClient.setUpdateMode(SqoopOptions.UpdateMode.UpdateOnly);
sqoopClient.setExportDir(inputDirForExportJob); // gets input from this directory in the HDFS
sqoopClient.setFileLayout(com.cloudera.sqoop.SqoopOptions.FileLayout.TextFile);
com.cloudera.sqoop.tool.SqoopTool sqoop_tool = com.cloudera.sqoop.tool.SqoopTool.getTool("export");
org.apache.sqoop.Sqoop sqoop_export = new org.apache.sqoop.Sqoop(sqoop_tool, hadoop_config, sqoopClient);
int status = 1;
try{
status = new ExportTool().run(sqoopClient);
}
return status;
Even tried executing throug command line
sqoop export --connect jdbc:oracle:thin:@192.168.2.175:1521:OPS1 --username ZYCDEV --password ZYCDEV --table abhishek_emp --update-key id --export-dir /user/abhisheks/bcr/check.txt --input-fields-terminated-by '|' --columns 'id,description' --update-mode updateonly
Still same issue..
我使用的cloudera版本是。。sqoop-1.4.2-cdh4.2.0.jar。。
1条答案
按热度按时间wvt8vs2t1#
那是一只虫子。尝试了新版本的sqoop,运行良好。