开发者

Is rollback can work without savepoints in DB2?

This question partially related to this one

Why my transaction is not rolled back when using the following SQL:

INSERT INTO TESTSCHEMA."test" (ID, NAME) VALUES (11111, 'SDFASDFASD');

ROLLBACK;

As I known from the DB2/iSeries documentation:

The ROLLBACK statement is used to end a unit of work and to back out the database changes that were made by that unit of work.

What is an indicator that unit of work started or ended? What will be rolled back in example mentioned above?

I would be very thankful for all answers and links.

PS. I am using DB2/iSeries V5R4.

PPS. Sorry for my bad E开发者_高级运维nglish


Everything in DB2 is done within a the scope of a transaction. A transaction ends on COMMIT (either explicit or implicit) or ROLLBACK.

Keep in mind that, by default, many clients have the autoCommit parameter set to true, which means that after every statement there is an implicit COMMIT.

So, in your example above, I'm going to assume that autoCommit was on, and the INSERT was committed immediately. Thus, the ROLLBACK statement did nothing.


Here's the iSeries Commitment Control topic for v5r4.

Here's the IBM Toolbox for Java Commitment Control topic for v5r4.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜