Connection conn = null;
try{
conn = DBConnectionFactory.getConnection;
conn.setAutoCommit(false); //do something
conn.commit(); //commit transcation
}catch(Exception e){
conn.rollback();
}finally{
try{
conn.close();
}catch(SQLException se){
//do sth.
}
//close ResultSet,PreparedStatement,Connection
//notice:Maybe ocurr Exception when u close rs,pstmt,conn
}









