🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.api
1 messages
1 total messages Started by Dan Rotaru Thu, 09 Dec 2004 03:52
statement.executeBatch()
#17
Author: Dan Rotaru
Date: Thu, 09 Dec 2004 03:52
33 lines
2262 bytes
I tried to use statement.execteBatch with many SQL querys with a Advatage server..
I was always given the same message : 'SQL Attempt to produce a ResultSet from executeBatch'
Instead, everything is good if I use only one query.
Here is the code I used.

myStatement = POSIS.createStatement() ;
try{
     if(POSIS.getMetaData().supportsBatchUpdates()){
       System.out.println( "Good : Driver supports Batch Updates." );
       POSIS.setAutoCommit(false) ;
        try {
          myStatement.clearBatch();
          String sql = "Update posPrHd1 SET LINKS = 'TTTTT' where LINKS = '4M351' ";
          int iCount = myStatement.executeUpdate(sql) ;      // good
          myStatement.addBatch(sql);
          int aArray[] = myStatement.executeBatch();        // good
          myStatement.addBatch(sql);
          aArray = myStatement.executeBatch();            // not good
        } catch( BatchUpdateException bue ){
          System.err.println(bue.getMessage());
          //bue.getMessage() = SQL Attempt to produce a ResultSet from executeBatch
        }
        POSIS.setAutoCommit(true) ;
     }else {
        System.err.println( "EBRun Error: Driver " + "does not support Batch Updates." );
        POSIS.closeConnection();
     }
}catch (Exception ee) {
       System.err.println(ee.getMessage()) ;
}

POSIS.setAutoCommit(false) ;
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads