0

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.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by mKorbel
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.