Subject | Re: [Firebird-Java] Do I need to commit every transaction if I'm using jaybird? |
---|---|
Author | Roman Rokytskyy |
Post date | 2005-02-02T10:08:56Z |
> If I'm builing an jsp/servlet apps using JDBC + jaybird, do I need toYou have to understand, that if you do not commit your transaction, it will
> commit my select,insert and update statements?
be automatically rolled back and your changes will be lost. For read-only
transactions it does not matter.
But you have also to know, that JDBC by default uses and "autocommit" mode.
This means, for each statement a new transaction is started, statement is
executed and transactions is committed (really committed, without checking
whether an error had happened or not, this also means if your statement
changed half of the code and then error happened, that half-correct state
will be made permanent; however I cannot provide an example for single
statement now).
> Is it a requirement of just a performance / safety precaution to commitFirst of all performance issue - transaction start and commit/rollback are
> after each transaction in jsp/servlet apps?
relatively expensive operations. Also if you want to execute few statements
in one transaction, you have no other chance as to switch the auto-commit
off.
Roman