Subject Re: [Firebird-Java] Do I need to commit every transaction if I'm using jaybird?
Author Roman Rokytskyy
> If I'm builing an jsp/servlet apps using JDBC + jaybird, do I need to
> commit my select,insert and update statements?

You have to understand, that if you do not commit your transaction, it will
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 commit
> after each transaction in jsp/servlet apps?

First of all performance issue - transaction start and commit/rollback are
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