Savepoint is an object which contain group of commands. A label given to group of transactions which is called Savepoint.
How to create savepoint
1. Savepoint setSavepoint() - Creates an unnamed savepoint in the current transaction and returns the new savepoint object that represents it.
PROGRAM
Savepoint s1 = con.setSavepoint();
st.executeUpdate("delete from dept where deptno=69");
Savepoint s2 = con.setSavepoint();
st.executeUpdate("update emp set sal=sal+300 where deptno=30");
Savepoint s3 = con.setSavepoint();
st.executeUpdate("update emp set sal=sal+500");
con.rollback(s2);
con.commit();
How to create savepoint
1. Savepoint setSavepoint() - Creates an unnamed savepoint in the current transaction and returns the new savepoint object that represents it.
PROGRAM
Savepoint s1 = con.setSavepoint();
st.executeUpdate("delete from dept where deptno=69");
Savepoint s2 = con.setSavepoint();
st.executeUpdate("update emp set sal=sal+300 where deptno=30");
Savepoint s3 = con.setSavepoint();
st.executeUpdate("update emp set sal=sal+500");
con.rollback(s2);
con.commit();
No comments:
Post a Comment