Hi James:
As you can see, I am continuing our off-line conversation from yesterday on-line now
since it seems like David Graham is thinking along similar lines (only a step ahead!)
and I'd like to add something based on what he's written. Ok, here's some code to try
if you'd like to give it a chance: (I know you have your reasons for writing the code
the way you did, but I still think this below is the more "traditional" way (am I
mistaken folks?) and I'm curious to see if it fails for you when the update fails.)
try{
run.update(conn, sqlStatement1);
run.update(conn, sqlStatement2);
run.update(conn, sqlStatement3);
conn.commit();
}
catch(SQLEXception sqle) {
log.error(..);
//and do nothing else: no need to rollback as David mentions
}
catch(..whatever..){
//do whatever..
}
finally{
if (conn != null) {
conn.setAutoCommit(true); //be safe for next use!
conn.close();
}
else {
//hmmm..??
}
}
I repeat what I mentioned offline to you, we once had a problem with a pool we were
using (not dbcp) where we set a Connection's autoCommit to false, but released it back
to the pool *without* setting autoCommit back to true. The next time that Connection
was obtained from the pool, no commits happened! Trying to debug that one was kind of
memorable especially since it only (appeared to) happen sometimes ..)
Yours is quite an interesting problem - I hope you will find the answer soon and post
it so we can see the solution.
Regards,
Geeta
> -----Original Message-----
> From: James Blashill [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 23, 2004 4:39 PM
> To: Jakarta Commons Users List
> Subject: RE: [DbUtils] MySQL rollback problem..
>
>
> If I weren't using connection pooling I wouldn't be concerned at all
> really..
>
> I've often wondered about what happens to uncommitted or rolled back
> data when using connection pooling (DBCP).. I browsed through the DBCP
> code a little and it looked to me as though if you didn't rollback the
> connection, DBCP wouldn't do it for you. And so when the
> connection was
> reused there was potential for the next transaction to commit
> old data?
> I have never gotten around to really testing this.. Has anyone else?
>
> Thanks,
>
> James
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]