I will give this a try and that is exactly what I was just trying to write. This is the second time in about 5 years that this has happened :( I need to get away from using XA but the application server was bitching without it.
Thank you for your help on this. It would have taken me much longer to come up with this myself. Brett -----Original Message----- From: Knut Anders Hatlen [mailto:[email protected]] Sent: Tuesday, December 06, 2011 9:27 AM To: [email protected] Subject: Re: how can I force a rollback of an XA transaction "Bergquist, Brett" <[email protected]> writes: > The JVM that derby was running in crashed with a SEGV. There > application server also went down. When I brought both up, the > database shows two XA transactions in the PREPARE state (looking at > syscs_diag.transaction_table) but the application server has no > reference to these transactions to force a rollback. Files in the > database “log” directory are being created, with 3862 being the > current count. > > I need a way to get this to be cleaned up. It would be best if this > could be done with the database online as I don’t have days to wait > for the database to come up. Hi Brett, If your application server doesn't manage to recover the transactions, you could try to run the XA recovery procedure manually. Something like this (untested) code: XAConnection xac = ...; // get connection from the XADataSource XAResource xar = xac.getXAResource(); for (Xid xid : xar.recover(XAResource.TMSTARTRSCAN)) { xar.rollback(xid); // or commit: // xar.commit(xid, false); } Hope this helps, -- Knut Anders
