0

I'm using Sqoop to update a table in oracle with UpdateOnly options. Have tried many suggestions mentioned on various site but it still doesn't work.

The code is as given below...

    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..

The cloudera version I'm using is .. sqoop-1.4.2-cdh4.2.0.jar..

Abhishek Singh
  • 275
  • 1
  • 2
  • 18

1 Answers1

0

It was a bug. Tried with newer version of sqoop and it's running fine.

Abhishek Singh
  • 275
  • 1
  • 2
  • 18