Re: Is statement.executeBacth() a transaction?
- From: George <zggame@xxxxxxxxx>
- Date: Thu, 30 Oct 2008 21:22:54 -0700 (PDT)
Thank you. As always, I got a bit more confused on the other by
clearing up one part. I originally thought all the statements in one
transaction are all executed or non executed in jdbc automatically. Am
I right? However, the second last paragraph in the article I linked
seems to say the opposite. It says one needs to rollback when
SQLExcption is thrown, which seems to indicate that one transaction
(one conn.commit()) might leave some statement executed and some
not.
On Oct 30, 7:48 pm, Lew <no...@xxxxxxxxxxxxx> wrote:
George wrote:
"Transaction" for me is just either all statements executes or none
run. I got the impression about the preparedstatement#addbatch() as a
transaction from sun's document here
http://java.sun.com/docs/books/tutorial/jdbc/basics/transactions.html.
They pointed out that rollback is not necessary in their example
program toward the end. So I figure that is executed as one
transaction.
That example makes no mention whatsoever of executeBatch(). The reason they
say rollback isn't necessary is because no further use is made of the data
after a SQLException. The tutorial even goes on to say:
If the application continued and used the results of the transaction,
however, it would be necessary to include a call to rollback in the
catch block in order to protect against using possibly incorrect data.
The paired statements in their example are, in fact, executed as a single
transaction, but that is not why rollback isn't needed.
--
Lew
.
- Follow-Ups:
- Re: Is statement.executeBacth() a transaction?
- From: Martin Gregorie
- Re: Is statement.executeBacth() a transaction?
- From: Lew
- Re: Is statement.executeBacth() a transaction?
- References:
- Is statement.executeBacth() a transaction?
- From: George
- Re: Is statement.executeBacth() a transaction?
- From: Lew
- Re: Is statement.executeBacth() a transaction?
- From: George
- Re: Is statement.executeBacth() a transaction?
- From: Lew
- Is statement.executeBacth() a transaction?
- Prev by Date: Re: signed applet - resetting once REFUSED?
- Next by Date: Re: How to call c++ com dll ?
- Previous by thread: Re: Is statement.executeBacth() a transaction?
- Next by thread: Re: Is statement.executeBacth() a transaction?
- Index(es):
Relevant Pages
|