Hadoop Map/Reduce
  1. Hadoop Map/Reduce
  2. MAPREDUCE-3695

Error:ORA 00911 invalid character(the result of mapreduce insert into oracle)

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.0-alpha
    • Fix Version/s: None
    • Component/s: mrv2
    • Labels:

      Description

      Exception occurred when the result of mapreduce insert into oracle except mysql.

      [org.apache.hadoop.mapred.Child.main(Child.java:234)] Exception running child : java.io.IOException: ORA-00911: invalid character at org.apache.hadoop.mapreduce.lib.db.DBOutputFormat$DBRecordWriter.close(DBOutputFormat.java:103) at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:545) at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:385) at org.apache.hadoop.mapred.Child$4.run(Child.java:217) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:742) at org.apache.hadoop.mapred.Child.main(Child.java:211) 2012-01-19 15:41:22 [INFO][main][org.apache.hadoop.mapred.Task]-[org.apache.hadoop.mapred.Task.taskCleanup(Task.java:996)] Runnning cleanup for the task

      The exception in the 161 line of the DBOutputFormat.java,modify as follows and exception fixed.
      the reason is more than a semicolon.

      public String constructQuery(String table, String[] fieldNames) {
      if(fieldNames == null)

      { throw new IllegalArgumentException("Field names may not be null"); }

      StringBuilder query = new StringBuilder();
      query.append("INSERT INTO ").append(table);

      if (fieldNames.length > 0 && fieldNames[0] != null) {
      query.append(" (");
      for (int i = 0; i < fieldNames.length; i++) {
      query.append(fieldNames[i]);
      if (i != fieldNames.length - 1)

      { query.append(","); }

      }
      query.append(")");
      }
      query.append(" VALUES (");

      for (int i = 0; i < fieldNames.length; i++) {
      query.append("?");
      if(i != fieldNames.length - 1)

      { query.append(","); }

      }
      query.append(");");

      return query.toString();
      }

        Activity

        Hide
        Harsh J added a comment -

        Cancelling 'Patch Available' status as there's no patch available here. Please follow http://wiki.apache.org/hadoop/HowToContribute and provide us a diff-patch against trunk for fixing this!

        Show
        Harsh J added a comment - Cancelling 'Patch Available' status as there's no patch available here. Please follow http://wiki.apache.org/hadoop/HowToContribute and provide us a diff-patch against trunk for fixing this!

          People

          • Assignee:
            Unassigned
            Reporter:
            杨果
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development