You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-issues@hadoop.apache.org by "杨果 (Updated JIRA)" <ji...@apache.org> on 2012/01/20 02:43:40 UTC

[jira] [Updated] (MAPREDUCE-3695) Error:ORA 00911 invalid character(the result of mapreduce insert into oracle)

     [ https://issues.apache.org/jira/browse/MAPREDUCE-3695?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

杨果 updated MAPREDUCE-3695:
--------------------------

    Status: Patch Available  (was: Open)
    
> 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: jobtracker
>    Affects Versions: 1.0.0, 0.21.0
>            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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira