[ 
https://issues.apache.org/jira/browse/MAPREDUCE-3695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14553288#comment-14553288
 ] 

ramtin commented on MAPREDUCE-3695:
-----------------------------------

I found this issue similar to MAPREDUCE-6246 so I updated [my 
patch|https://issues.apache.org/jira/secure/attachment/12734265/MAPREDUCE-6246.003.patch]
 for fixing this problem, too.

> Error:ORA 00911 invalid character(the result of mapreduce insert into oracle)
> -----------------------------------------------------------------------------
>
>                 Key: MAPREDUCE-3695
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-3695
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>          Components: mrv2
>    Affects Versions: 2.0.0-alpha
>            Reporter: 杨果
>              Labels: patch
>
> 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();
>   }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to