NonStop Server for Java (NSJ) Programmer's Guide (NSJ 2.1+)
Using a DataSource object increases the application portability by allowing the application to use a logical name
for a data source instead of providing driver-specific information in the application. A logical name is mapped to a
DataSource object by means of a naming service that uses the Java Naming and Directory Interface (JNDI).
The following table describes the set of properties that are required to identify a JDBC/MX data source object:
Property Name Type Description
dataSourceName String
The data source name
description String
The description of the data source
catalog String
The default catalog name
Schema String
The default schema name
nameType String
The default name type
Transactions
The JDBC/MX driver provides transaction support to maintain data integrity and consistency. To allow the application
to interleave transactions between SQL/MX objects and the traditional file system, the JDBC/MX driver checks if a
transaction is active whenever it needs to interact with SQL/MX.
When an active transaction exists, the autocommit setting is ignored and the JDBC/MX driver lets the
application manage the transaction.
●
When no active transaction exists, the JDBC/MX driver manages the transactions.●
This implementation differs from JDBC/MP. In the JDBC/MP driver, there are two different types of URL to decide
which component manages the transaction.
Autocommit Mode and Transaction Boundaries
When JDBC/MX manages the transactions, the driver makes the decision to start a new transaction. A new transaction
is started when no transaction is associated with the Connection. When there is a transaction associated with the
Connection, that transaction is resumed. The Connection attribute autocommit specifies when to end the
transaction. Enabling autocommit causes the JDBC/MX driver to end the transaction in accordance with the following
rules:
The JDBC/MX driver aborts the transaction for any SQL error in SQL statements other than SELECT
statements.
●
In the case of non-SELECT SQL statements, the JDBC/MX driver commits the transaction if the current
transaction was started for this SQL statement.
●
In the case of SELECT statements, the JDBC/MX driver commits the transaction at the time of closing the result
set.
●
In the case of concurrent multiple SELECT statement, the JDBC/MX driver commits the transaction when any
SELECT statement result set is closed.
●
Disabling Autocommit Mode
When the autocommit mode is disabled, the application must explicity commit or roll back each transaction by calling
the Connection methods commit and rollback, respectively. When any SQL error occurs in SQL statements
other than SELCT statement, SQL/MX flags the transactions for aborting. In such a case, the transaction is rolled back