Rollback not working
- From: bcr666 <bcr666@xxxxxxxxx>
- Date: 10 May 2007 13:28:51 -0700
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();
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();
}
failure ///////////////////////////////////////////////////////////////
// end email
failure ///////////////////////////////////////////////////////////
}
}
.
- Follow-Ups:
- Re: Rollback not working
- From: joeNOSPAM@xxxxxxx
- Re: Rollback not working
- Prev by Date: Re: Where to store SQL statement
- Next by Date: Re: Rollback not working
- Previous by thread: .Net VC++ Java C++ Windows Internals Unix Internals
- Next by thread: Re: Rollback not working
- Index(es):
Relevant Pages
|
|