Subject | Re: autocommit mode |
---|---|
Author | Roman Rokytskyy |
Post date | 2003-06-09T15:09:09Z |
Hi,
in case of error. However, I do not know what happens if multiple
triggers are fired for one statement. In theory _all_ changes should
be discarded.
or rollback() when auto-commit is on. You will get an exception in
this case.
rolled back. Driver is relatively simple here. It tries to commit
transaction, if commit fails, it performes rollback (probably we can
simply rollback tx in auto-commit case). So, it is the responsibility
of the database server to _not allow_ transaction to be committed. I
am almost 100% sure that in scenario described above transaction will
be rolled back.
Best regards,
Roman Rokytskyy
> Let's suppose I set autoCommit(true) and execute a SQL statementAll changes made by a trigger are discarded by the server internally
> which fires a trigger in my database. The trigger tries to make some
> updates in a table. After some registers are successfully updated,
> it fails because a primary key constraint. So the java application
> receives a SQLException.
in case of error. However, I do not know what happens if multiple
triggers are fired for one statement. In theory _all_ changes should
be discarded.
> In this situation, am I expected to do conn.rollback() in the catchAccording to the specification you are not allowed to execute commit()
> block, to ensure every updated register is conveniently rolled back,
> or is this opertation automatically perfomed because of the
> autocommit mode?
or rollback() when auto-commit is on. You will get an exception in
this case.
> So the general question could be: what happens after a SQL errorIn general it is quite interesting question... Transaction should be
> occurs and autocommit mode is switched on?
rolled back. Driver is relatively simple here. It tries to commit
transaction, if commit fails, it performes rollback (probably we can
simply rollback tx in auto-commit case). So, it is the responsibility
of the database server to _not allow_ transaction to be committed. I
am almost 100% sure that in scenario described above transaction will
be rolled back.
Best regards,
Roman Rokytskyy