JDBC Driver for SQL/MP 3.0
PreparedStatement stmt;
stmt = conn.prepareStatement("insert into foo values(?,?,??);
Note that the last two question marks are not separated by commas; the first question mark of the pair indicates that a
value can be set for this column (the deptnum column, as these question marks appear in the third position) and the
second is the null indicator, showing that the column can be set to null. If the second question mark is not present, the
column could not be set to null.
Transactions and the JDBC Driver for SQL/MP
The Transaction Management Facility (TMF) is the system entity that manages transactions. You cannot make
procedure calls to TMF directly from any Java application. You must use either the com.tandem.tmf.Current class
(described in the NonStop Server for Java API Reference) or the Java Transaction API (JTA) to manage transactions.
Autocommit Mode and the Standard Driver
In autocommit mode, the standard driver automatically manages transactions for you. You do not need to explicitly
begin and end transactions. In fact, if you have used the Current class method or JTA to begin a transaction before
calling the standard driver, the driver throws an exception.
Each statement forms a separate transaction that is committed when the statement is closed or the next time an
executeQuery, executeUpdate, or execute method is called. When a ResultSet is returned, the standard driver
commits the transaction when the last row of the result set is retrieved, when the ResultSet is closed, or when the
statement is closed (which automatically closes the ResultSet). If you invoke another executeQuery, executeUpdate,
or execute method when a ResultSet is open, the driver closes the result set andcommits the transaction. The driver
then begins a new transaction for the newly called method.
Autocommit mode is the default for the standard SQL/MP driver.
Nonautocommit Mode and the Standard Driver
In nonautocommit mode, you must manually commit or roll back a transaction. In this mode, a transaction is defined
as all the statements preceding an invocation of commit() or rollback(). Both commit() and rollback() are
methods in the Connection class.
Autocommit Mode and the Transaction-Aware Driver
Requesting autocommit mode (that is, specifying setAutoCommit(true)) with the transaction-aware driver causes an
SQLException.
Nonautocommit Mode and the Transaction-Aware Driver
Nonautocommit mode is the default for the transaction-aware driver. You must manage all transactions using
com.tandem.tmf.Current or the JTA.
JDBC DriverManager