Rollback not working



I have db2 running on an AIX machine, and running my program from
JBuilder on a WinXP machine. I downloaded the newest db2jcc.jar and
lecense file today and installed them.

If I get an exception, the rollback() is called (I stepped thru the
code and verified), but the tables in the database have the new
information in them.

Is there something I'm missing?

my code is as follows
...
try {

StatementManager.getConnection(StatementManager.CONNECTION_WRITE).
setAutoCommit(false);
}
catch (SQLException ex) {
ex.printStackTrace();
}
Savepoint savepoint = null;
PreparedStatement pStmt =
StatementManager.getPreparedStatement(StatementManager.PREPARE_UPDATE_BURST);
// get our list of approved assignments
for (Iterator iter = burstAssignments.iterator();
iter.hasNext(); ) {
CronFFABurstAssignment burstAssignment =
(CronFFABurstAssignment) iter.
next();
if (checkAssignmentOK(burstAssignment)) {
// create assignment in respective tables
try {
// set my rollback save point
savepoint =
StatementManager.getConnection(StatementManager.CONNECTION_WRITE).setSavepoint("TEst");
createAssignment(burstAssignment);
// the above statement updates several tables if there is an
exception somewhere in there, I want the connection to roll back to
the save point
// if no exceptions were caught, mark the assignment as
sent.
pStmt.setInt(1, valSentId.intValue());
pStmt.setInt(2, burstAssignment.getId().intValue());
pStmt.execute();

StatementManager.getConnection(StatementManager.CONNECTION_WRITE).
commit();
// email
success ///////////////////////////////////////////////////////////////
// end email
success ///////////////////////////////////////////////////////////
}
catch (Exception ex) {
ex.printStackTrace();
try {
System.out.println("Rolling back");

StatementManager.getConnection(StatementManager.CONNECTION_WRITE).
rollback(savepoint);
}
catch (Exception ex1) {
ex1.printStackTrace();
}
// email
failure ///////////////////////////////////////////////////////////////
// end email
failure ///////////////////////////////////////////////////////////
}
}

.



Relevant Pages

  • Re: C# Language Proposal for out Parameters
    ... >> If the assignment isn't made because an exception has been thrown, ... inout semantics, not to mention reducing overall clarity of the code. ... The fundamental problem is that GetNewValue would ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Controlled types and exception safety
    ... >> propagate an exception. ... >> For an Adjust invoked as part of an assignment operation, ... But a user-defined constructor is ... a user-defined constructor has just turned on the ...
    (comp.lang.ada)
  • Re: Pop Quiz: Raising an exception inside a function in relation to the return values.
    ... (If the exception were raised if (Random<0.50), ... Simply pretend the raise is a return and you ll see the difference. ... No second assignment ever happens. ... try-except statements switch back ...
    (alt.comp.lang.borland-delphi)
  • Re: Why I dont believe in static typing
    ... > modifying global data, since it's an effect that isn't represented ... An "overlay" is temporary, scoped assignment to some other mutable ... caught exception, presumably before rethrowing). ...
    (comp.lang.lisp)
  • Re: Try Catch Finally , pointers and Vb.net 2005 compiler warnings
    ... A null reference exception could result at runtime. ... The 'f' in front of 'IsNot' is underlined and the warning included as a comment in the snippet above is shown. ... It leads people to write explicit assignments, which is not necessary because the compiler adds the assignment automatically. ... possible, but not always the best solution (minimum scope is often the best choice, and in this particular case it's the same scope). ...
    (microsoft.public.dotnet.languages.vb)