NonStop Server for Java (NSJ) Programmer's Guide (NSJ 2.0+)
Autocommit Mode
In autocommit mode, the driver automatically commits a transaction without your having to call commit(). Each
statement forms a separate transaction that is committed when the statement is completed or when the next execution
occurs (whichever comes first). When a result set is returned, the statement is completed when the last row of the result
set is retrieved or when the result set is closed. If you invoke another executeQuery or executeUpdate method
while a result set is open, the result set is closed and the transaction is committed; a new transaction is then begun for the
newly invoked method.
Autocommit mode is the default for the original driver. The default for the transaction-aware driver is nonautocommit
mode. Trying to use autocommit mode with the transaction-aware driver causes an exception.
To select autocommit mode, use setAutoCommit(true). (setAutoCommit(boolean) is a
SQLMPConnection method.)
Nonautocommit Mode
In nonautocommit mode, you must manually commit or roll back statements. In this mode, a transaction is defined as all
the statements preceding a commit() or rollback().
For the transaction-aware driver, nonautocommit mode is the default mode and the only valid mode. Trying to use
autocommit mode with the transaction-aware driver causes an exception. The default for the original driver is
autocommit mode, but it can also use nonautocommit mode.
To select nonautocommit mode, use setAutoCommit(false). (setAutoCommit(boolean) is a
SQLMPConnection method.)
To manually commit one or more statements, use the commit() method. The commit() method makes permanent all
changes made since the previous commit or rollback and releases any database locks held by the connection.
To manually roll back one or more statements, use the rollback() method. The rollback() method drops all
changes made since the previous commit or rollback and releases any database locks held by the connection.
Both commit() and rollback() are SQLMPConnection methods.
SQL/MP Driver Requirements
The SQL/MP drivers, sqlmp and sqlmptx, require that the Java Virtual Machine (JVM), java, be compiled by the
SQL Compiler.
NSJ includes a Makefile (/usr/tandem/install/Makefile) that compiles java, the JVM, with the SQL
compiler:
To execute this Makefile, follow these steps:
Log on to the OSS environment as super.super.1.
Change directory (cd) to /usr/tandem/java/install.2.
Type make javasqlcomp to invoke the makefile.3.
For more information about the Makefile, see /usr/tandem/java/install/README.