https://bz.apache.org/bugzilla/show_bug.cgi?id=60522

            Bug ID: 60522
           Summary: An option for setting if the transaction should be
                    rolled back when a connection is abandoned
           Product: Tomcat Modules
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: jdbc-pool
          Assignee: dev@tomcat.apache.org
          Reporter: lff0...@gmail.com
  Target Milestone: ---

Currently, if the connection is abandoned, it do nothing to commit() or
rollback(). 
However, I have seen problems for this, especially on Oracle, because for
Oracle, the Oracle JDBC driver will commit the transaction when close() is
called. See
http://stackoverflow.com/questions/218350/does-java-connection-close-rollback

So, the following code will causes dirty data in DB:

Connection conn = getConnectionFromPool();
try {
     //Do something with the conn. And after some time, it is ABANDONED.
    conn.commit(); // OOPS!!!! Connection already closed because it is
abandoned and closed.
} catch (Exception e) {
     log it;
     conn.rollback();  <===== Rollback failed, because the connection is
abandoned and closed.
} 

!!!!!!!! Dirty data got. Because in Oracle, the JDBC driver will commit() the
transaction when the connection is closed.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to