Hi ,
I have a problem. I am inserting 5 rows into a table. Before inserting i disabled the auto commit(conn.setAutoCommit(false)). And after i have not at all commited the transaction. And i used rollback for every exception in catch block. But, The transactions are saving up to the exception. This is my code
public void saveFeedback(String optionId, String qid, String date, Connection conn)
{
try{
conn = openDB();
conn.setAutoCommit(false);
sql = "insert into FEEDBACK_USER (ID, USERID, EID, FEEDBACKID, QUESTIONID, CREATEDON, COMMENTS, OPTIONID) values (FEEDBACK_USER_SEQ.nextval,'"+userId+"','"+eId+"','"+feedbackId+"','"+questionId+"','"+date+"','"+comment+"','"+optionId+"')";
Statement st = conn.createStatement();
st.executeUpdate(sql);
}
catch(Exception e){
e.printStackTrace();
try{
conn.rollback();
}catch(Exception e1){
}
}
finally{
try{
conn.close();
}catch(Exception e){
}
}
}
Thanks and Regards
Bhanu.