• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Rollback and different queries in batch

 
Ranch Hand
Posts: 163
Netbeans IDE Tomcat Server Java
  • 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 ?
 
Marshal
Posts: 25805
69
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
Ranch Hand
Posts: 163
Netbeans IDE Tomcat Server Java
  • 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
Marshal
Posts: 25805
69
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
Ranch Hand
Posts: 163
Netbeans IDE Tomcat Server Java
  • 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
Marshal
Posts: 25805
69
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
Ranch Hand
Posts: 163
Netbeans IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.. ..fine ..Thanks Paul.
    Bookmark Topic Watch Topic
  • New Topic