• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Rollback and different queries in batch

 
Divya Shiv
Greenhorn
Posts: 25
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is it possible to rollback only the selected/required queries once batch query execution is performed? Is there no way to execute different types of queries during batch execution ?
 
Paul Clapham
Sheriff
Posts: 21559
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't rollback queries, you only rollback updates to the database. And you can't selectively rollback updates, you can only rollback all updates since the last commit or rollback. It also doesn't make any difference whether those updates were done in a batch or not.
 
Divya Shiv
Greenhorn
Posts: 25
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks Paul. I meant updates to the database. As you said that changes could be rolled back since last commit, but Is there any possibility to rollback using addBatch()(normally used for catching the exception) for set of queries, just in case ?
 
Paul Clapham
Sheriff
Posts: 21559
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:It also doesn't make any difference whether those updates were done in a batch or not.


But probably I don't understand what you're trying to ask. Nothing in the rules about committing and rolling back mentions batches in any way, though.
 
Divya Shiv
Greenhorn
Posts: 25
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I meant when queries are executed in batch and there is some error due to one particular query of the batch, is there any way so as to rollback the updates caused by faulty query? Just searching for a method to do this in case of large batch file.
 
Paul Clapham
Sheriff
Posts: 21559
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wish you would stop referring to updates as "queries". It's very distracting. Anyway, it's as I have already said twice now -- I will let you go back and read what I wrote. Or check the documentation if you like, but you'll see for yourself that the way rollback works is very simple. If you're hoping there are additional features not mentioned there, well, sorry, there aren't.
 
Divya Shiv
Greenhorn
Posts: 25
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.. ..fine ..Thanks Paul.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic