File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Problem in rolling back some transactions. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Problem in rolling back some transactions." Watch "Problem in rolling back some transactions." New topic

Problem in rolling back some transactions.

Pooja Agarwal
Ranch Hand

Joined: May 19, 2004
Posts: 37
Hai All,

I am finding diff in rolling back some transactions.
Actually in my application (ie in Servlet) i have 5 callable statements to execute 5 stored procedures.
I have one connection object.

I have to execute these stored procedures in sequence. If any stored procedures returns non zero value i have to stop

execution and roll back all the transactions.
If all the 5 stored procedures return 0 then i have to commit the transaction.
i have used the following logic to do so.
But the problem is, i am failing to rollback the tranaction.
SP5 is returning non zero value, its displaying "error in SP5", but
is not rolling back all the transactions. Plz let me know how to roll back all the transactions.
Is there any mistake in my logic. ??

SP2 and SP3 are executed more than once and are included in for loop.

SP = Stored procedure.

Any help would be appreciated.
Thanks in advance
Dillip Mohapatra

Joined: Jul 07, 2004
Posts: 7
Hi Pooja,

I just went through the history of queries posted by you.
From that, what I could understand, the possibility of the
error segment can be
1. either you need to make sure that you wanted to execute
all the callable statements using the same connection.
2. check your stored procedures, if there is any bug, like
commit within itself.

Otherwise, code, logic looks fine.


Dillip Mohapatra
Don't get me started about those stupid light bulbs.
subject: Problem in rolling back some transactions.
It's not a secret anymore!