NonStop Server for Java (NSJ) Programmer's Guide (NSJ 2.0+)

Row sets
JNDI for Naming Databases
For JDBC 1.0, the only way to connect to a database was by using the JDBC driver manager. With this approach, the JDBC
driver that is used to create a database connection must first be registered with the JDBC driver manager. A drawback of this
approach is that the JDBC driver class name usually identifies a particular JDBC driver vendor that makes the code that loads
the driver specific to that vendor's product; it is therefore not portable. In addition, an application needs to specify a JDBC
URL when connecting to a database by means of the driver manager; this URL might not only be specific to a particular
vendor's JDBC product, but (for databases other than SQL/MP) might also be specific to a particular machine name and port.
Using JNDI (Java Naming and Directory Interface) solves the problems just mentioned by allowing an application to specify a
logical name that JNDI associates with a particular data source.
A JDBC data source object is a Java programming language object that implements the DataSource interface. A data source
object is a factory for JDBC connections. Like other interfaces in the JDBC API, implementations of DataSource must be
supplied by JDBC driver vendors.
JDBC Data Source Properties
The JDBC 2.0 API specifies the following standard names for data source properties:
DatabaseName
DataSourceName
Description
Network Protocol
Password
RoleName
ServerName
UserName
All of these data source properties are of type String, and all are optional except the Description property, which is
required to provide a description of the data source. NonStop
TM
Server for Java includes the property TransactionMode,
also of type String. Acceptable values for that property are INTERNAL or EXTERNAL. If you specify INTERNAL, JDBC
manages (begins/ends/rolls back) transactions within the connection. If you specify EXTERNAL, you are responsible for
beginning and ending transactions.
Connection Pooling
A connection pool is a cache of database connections that is maintained in memory so that the connections can be reused.
NonStop
TM
Server for Java does not support connection pooling because it is normally implemented by the middle-tier server
vendor.
Distributed Transactions
From an application perspective, the NonStop
TM
Server for Java JDBC driver supports distributed transactions in a standard
way, as described in the JDBC 2.0 Standard Extensions document; namely, the JDBC API assumes that distributed transaction
boundaries are controlled either by a middle-tier server or another API, such as the user transaction portion of the Java
Transaction API. NonStop
TM
Server for Java does not support the middleware (those implementing resource managers) pieces
of distributed transactions. Instead, NonStop
TM
Server for Java leaves the implementation of such functionality to the
middleware vendor.
The user transaction portion of javax.transaction is implemented. At run time, NonStop
TM
Server for Java detects
whether the Java Transaction Services (JTS) are present. If JTS is present, the transaction is delegated to JTS. If JTS is not
present, the transaction is delegated to com.tandem.tmf.
For the reasons just mentioned, NonStop
TM
Server for Java does not support the XADataSource interface nor the
XAConnection interface. None of the classes or interfaces in javax.transaction.xa are supported.