• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Rollback and different queries in batch

 
Ranch Hand
Posts: 171
Netbeans IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 171
Netbeans IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 171
Netbeans IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 171
Netbeans IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok.. ..fine ..Thanks Paul.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic