sqoop导出更新失败,索引::2处缺少in或out参数

5vf7fwbs  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(458)

我使用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。。

wvt8vs2t

wvt8vs2t1#

那是一只虫子。尝试了新版本的sqoop,运行良好。

相关问题