|
From: <tri...@tr...> - 2003-10-16 16:15:23
|
Juergen,
>
> I just found this in Oracle9i JDBC Developers Guide and Reference
>
> Important:
> 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.
>
> 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.
>
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
|