Archives of the TeradataForum
Message Posted: Tue, 26 Feb 2008 @ 21:22:06 GMT
Subj: | | Re: Transaction Control with JDBC |
|
From: | | McCall, Glenn David |
| The JDBC driver documentation says that by default the driver issues a "commit" command after every request. To us that seems to imply
that whether the session logs on in either Teradata (BTET) or ANSI transaction mode effectively the same things will happen (in terms of
transactions). | |
The complex answer is it depends. The simple answer is that most likely your tool will not use the transaction API's (mentioned below) and each
request will be committed upon completion.
| We're starting the development of our first JDBC application and the following question has been raised concerning transaction
control. | |
JDBC (and ODBC and other connectivity mechanisms) provides API's to manage transactions.
In Java, you should look at java.sql.Connection.setAutoCommit (), java.sql.Connection.commit () and java.sql.Connection.rollback ()
The java docs for setAutoCommit say that by default connections will be in auto commit mode.
| Assuming that this default action is not changed, what happens if your SQL includes explicit transaction (BT/ET) commands ? Do they
get ignored ? | |
Depends upon the above. In the default commit mode (i.e. auto commit = true), BT and ET appear to be ignored.
| Alternatively, how have other sites handled the requirement to have multiple SQL requests treated as a single transaction when using
a JDBC interface? | |
Well you could use the API's mentioned above. Other options include multi-statement requests and macros.
Hope this helps
Glenn Mc
|