 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Dan Rotaru Guest
|
Posted: Thu Dec 09, 2004 3:52 am Post subject: statement.executeBatch() |
|
|
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) ;
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|