Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> OCCI: how to do a BATCH UPDATE?

OCCI: how to do a BATCH UPDATE?

From: Andreas Baudisch <andreas.baudisch_at_icn.siemens.de>
Date: 13 Mar 2002 14:04:35 GMT
Message-ID: <01c1ca97$f9647f70$d2425c9e@hfdw0185>


Hello,

I would like to use Oracle's OCCI to send a BATCH UPDATE (known form JDBC) to the
DBMS. It seems that OCCI is not able to do it like JDBC.

How can I do a BATCH UPDATE with OCCI?

I know there is a addIteration() in the interface of the OCCI Statement, but in my opinion this is not the appropriate
operation. It's only iterating parameters of a Parameterized Statement but I need to change the SQL string in every batch line (without calling executeUpdate).

Please have a look to the following JDBC example to see, what I want to do:

class test {
...

  private static void doBatch (Connection con)   throws SQLException
  {

      String s1 = "INSERT INTO ...";
      String s2 = "UPDATE ... SET ...";
      String s3 = "DELETE ...";

      con.setAutoCommit(false);
      Statement stmt = con.createStatement();

      System.out.println("Adding batch: "+s1+"\n");
      stmt.addBatch(s1);

      System.out.println("Adding batch: "+s2+"\n");
      stmt.addBatch(s2);

      System.out.println("Adding batch: "+s3+"\n");
      stmt.addBatch(s3);

      System.out.println("Executing batch ...\n");
      int [] updateCounts = stmt.executeBatch();

      for(int i=0; i<updateCounts.length; i++)
        System.out.println("Count["+i+"]="+updateCounts[i]);

      System.out.println("Done.\n");
      stmt.close();

  }

...

}

How can I do this in OCCI?
Could you please help me?

Thank you,
Andreas. Received on Wed Mar 13 2002 - 08:04:35 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US