On 23 December 2011 10:09, Daniel Migowski <dmigowski@ikoffice.de> wrote:
> If I send a statement with a BEGIN token
Don't do that; the driver is expecting you to manage transaction
demarcation by using JDBC's autocommit setting and commit/rollback,
not by sending explicit SQL. (Kevin pointed out the relevant JDBC
javadoc that covers this in his reply)
If you must send a raw BEGIN for some reason, then you're also
responsible for transaction cleanup yourself (i.e. don't expect
commit() or rollback() to work; you must send appropriate SQL yourself
to commit or rollback the transaction)
The driver's implementation of autocommit boils down to "if autocommit
is off and the connection does not have an active transaction, then
send BEGIN before the next query". When autocommit is on, the driver
just assumes the server's default behavior - i.e. autocommit happens
without any special intervention. If you send an explicit transaction
demarcation commands, you'll confuse that.
Oliver