aspose file tools*
The moose likes Websphere and the fly likes AS400 rolledback Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "AS400 rolledback" Watch "AS400 rolledback" New topic
Author

AS400 rolledback

Rolando Ochoa
Greenhorn

Joined: Aug 09, 2004
Posts: 16
I have a problem when I'm saving records in a database in AS400. I put transactionz supported, requiered, not supported, etc) to the EJB, that is using the method who is writing to the database. Every thing its ok, but after 10 mins or more or sundently send the rolled back, and delete all records saved. If I do not use transacactions (supported, requeried, etc) I receive rolled back instantly, and finish with error. With transaccions I do not receive nothing and I don't know how to find the error, because the rolledback happens after time.

I'm using whebsphere 5.1 and the conection is with datasoruces, maybe I need something else in datasources.

Does anyone can help me, because I have a lot of time with this problem. Any commentary It will be useful. Thanks for your help.


Rolando Ochoa
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
My guess would be that you disabled autocommit and then never issued a commit -- the result being that you build up transactions in the log/journal until it reaches a critical threshold. When the threshold is reached, an exception is thrown internally forcing the connection to close and rollback.


"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
Rolando Ochoa
Greenhorn

Joined: Aug 09, 2004
Posts: 16
Thanks for your answer David you were very helpful. I put commit after save all records, and it work fine, there is not rollbak and the records are ok. But I still have a problem. I put null in a Data (after 9000 records) and an error exists when I try to save records, I just wanted to see if rollback happens but it dosen't work, the rollback not exist. The data null error is before commit, so the commit is not executed. Maybe it will happens after long time, maybe 3 hrs, or more or never happens.

How can I force the rollback?, or do exist any way to run it manually and immediately? any suggestion could help me.

I did my test of transactions with supports and not supports

thanks in advance...
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
that's what try/catch/finally is for. =)

//Declare connection
Connection conn = null;
try
{
// get connection
// process data
// commit changes
}
catch(Exception e)
{
// handle exception;
// if conn!=null roll back
// (and anything else you want to do)
}
finally
{
// if conn!=null close it
}

Every step above is necessary or you'll have issues. You'll either commit something you don't want, roll back something you do, or leak connections.
That's all bad.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AS400 rolledback