BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

statement.executeBatch()

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> JBuilder JavaAPI
View previous topic :: View next topic  
Author Message
Dan Rotaru
Guest





PostPosted: Thu Dec 09, 2004 3:52 am    Post subject: statement.executeBatch() Reply with quote




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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> JBuilder JavaAPI All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.