|
From: <jue...@we...> - 2003-10-16 16:18:42
|
What happens if you provoke a Connection.commit failure, is there an =
implicit rollback then on the two databases? The question is probably: =
How to make the commit call fail?
Juergen
-----Original Message-----
From: tri...@tr... [mailto:tri...@tr...]
Sent: Thursday, October 16, 2003 6:15 PM
To: tri...@tr...
Cc: j=FCrgen h=F6ller [werk3AT];
spr...@li...
Subject: RE: [Springframework-developer] Hibernate commit/rollback
Juergen,
>=20
> I just found this in Oracle9i JDBC Developer's Guide and Reference
>=20
> Important:
> =01 If auto-commit mode is disabled and you close the connection
> without explicitly committing or rolling back your last changes,
> then an implicit COMMIT operation is executed.
>=20
> That's the opposite behavior from what I read in a JDBC book this =
morning -
> who
> do you trust?? I'm going to try this when I get some time.
>=20
I ran this sequence in both Oracle and HSQL:
getConnection
setAutoCommit(false)
createStatement()
statement.execute("insert ...")
statement.execute("insert ...")
statement.execute("insert ...")
statement.close()
/* no commit here */
connection.close()
In Oracle I get the rows committed to the database and in HSQL I do not. =
So
there is a big difference between the implementations here.
So my earlier statement:
>> My understanding is that unless you explicitly call a commit on the =
JDBC
>> connection, you should _never_ see any changes in the database.
was wrong - Oracle "conveniently" commits them for you :-)
Thomas
|