Please let me know when do we require to call the method connection.rollback();
try{
connection = getConnection();
connection.setAutoCommit(false);
pstmt1 = connection.preparedstatement ( ... );
...
pstt1.executeUpdate();
pstmt2 = connection.preparedstatement ( ... );
...
pstt2.executeUpdate();
connection.commit();
}catch ( Exception sqe ) { sqe.printStacktrace();
}finally {
closeQuitely ( pstmt1 );
closeQuitely ( pstmt2 );
closeQuitely ( connection );
}
In above code we are not using connection.rollback(), but if some exception occurs, even then everything will work fine [ i guess ], cos connection is already set in autoCommit = false mode.
So what could be the possible situation when we need to use this method. Please post the example as well.