Re: Is statement.executeBacth() a transaction?
- From: George <zggame@xxxxxxxxx>
- Date: Fri, 31 Oct 2008 08:47:44 -0700 (PDT)
That same article points out that all statements in a transaction are
committed or rolled back together. That is, after all, the entire point of
transactions.
So let me rephrase my question. If I do something like this
try{
conn.setAutoCommit(false);
Statement state1=conn.createStatement();
state1.addBatch("update XXXX");
state1.addBatch("update YYYY");
state1.executeBatch();
conn.commit();
}
catch( SQLException e){
if (conn!=null)
try{ conn.rollback();}
catch(SQLException e){
}
}
Is it necessary to put the rollback() there to guarantee the integrity
of the database or is the transaction (one commit) already guarantee
that? In another word, is the rollback function of the transaction
built-in in the jdbc's commit or do I need to implement it manually?
Sincerely
Zhu, Guojun
.
- Follow-Ups:
- 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
- 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: How to set the compiler to handle thousand loops ?
- Next by Date: Re: Is statement.executeBacth() a transaction?
- Previous by thread: Re: Is statement.executeBacth() a transaction?
- Next by thread: Re: Is statement.executeBacth() a transaction?
- Index(es):
Relevant Pages
|