I have this method :
public void ExecuteSQL(String SQL)
{
Koneksi getCn = new Koneksi();
Connection cnExecute = null;
try {
cnExecute = getCn.getConnection();
int rowNgefek = 0;
Statement stExecute = cnExecute.createStatement();
cnExecute.setAutoCommit(true);
stExecute.executeUpdate(SQL, rowNgefek);
cnExecute.commit();
closingConnection (cnExecute,stExecute);
}
catch (SQLException e)
{
System.out.println(e.toString());
}
}
If insert/delete/update raise error, I want to rollback all transactions.
It means I have to use cnExecute.rollback();
but I dont know where I should put that code..
In catch(SQLException e)
does not recognize cnExecute.rollback();
Thanks,
Kusno