Connection pooling – HP Integrity NonStop J-Series User Manual

Page 189

Advertising
background image

NOTE:

NonStop Server for Java supports transactions by means of the NonStop Server for JTA, which
is an implementation of the Sun Microsystems JTA.

NonStop Server for JTA implements the package, javax.transaction.

NonStop Server for Java includes the JTA package com.tandem.jta.

Configurations using JTA

The application code must implement JTA user transaction by using JTAFactory provided with the
NonStop Server for Java Transaction API package com.tandem.jta. This can be achieved by
following the below given steps:

1.

Define a JTA user transaction.

javax.transaction.UserTransaction tx = null;

2.

Initialize the user transaction.

tx = com.tandem.jta.JTAFactory.getUserTransaction();

3.

Begin the transaction.

tx.begin();

4.

Commit or rollback the transaction depending upon the status of the operations performed.

tx.commit();

or

tx.rollback();

Configurations using JDBC

To use JDBC Transaction Manager, complete the following steps:

1.

Open the session.

Session session = factory.openSession();

2.

Initialize the user transaction.

Transaction tx = null;

3.

Begin the transaction.

tx = session.beginTransaction();

4.

Perform the database operation.

session.load(...);
session.persist(...);

5.

Commit or rollback the transaction depending upon the status of the operations performed.

tx.commit();

or

tx.rollback();

Connection Pooling

Connection Pooling is a cache of database connections maintained in the database memory so
that the database connections can be reused when the database receives any future requests for
data. In this case, whenever a database operation needs to be performed, a request for an existing
database connection is made to a pool or any object that holds the existing database connections.
Once that particular database operation is completed, the connection is returned to the pool.

Hibernate Framework Configurations for NonStop Systems 189

Advertising
This manual is related to the following products: