File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes SavePoint in JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SavePoint in JDBC" Watch "SavePoint in JDBC" New topic
Author

SavePoint in JDBC

Santosh Maskar
Ranch Hand

Joined: Jul 02, 2003
Posts: 226
Hi,
I had set the save point in my code after 2 insert statment , when i will rollback the transaction then it will roll back up to save point , now i need to roll back all the trancastion , i mean i need to rollback the transaction from begining , (before the savepoint) can i do this

code
insert
update
savepoint save1

insert
rollback

then it will rollback the transaction upto savepoint

i need to roll back from first

how i can do this.


Regards
Santosh
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
There are two overloaded versions of Connection.rollback(). The one that takes a Savepoint argument should rollback the transaction to the specified Savepoint; the other one should rollback the whole transaction, i.e. to the last commit point. You need to ensure you have setAutoCommit(false).

If that doesn't work for some reason you could try calling releaseSavePoint() before your rollback.

Jules
Santosh Maskar
Ranch Hand

Joined: Jul 02, 2003
Posts: 226
Hi
Its working as per your tips

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SavePoint in JDBC