Sun Java System Application Server Platform Edition 9 Developer's Guide

Storing Transaction Logs in a Database

For multi-core machines, logging transactions to a database may be more efficient.

To log transactions to a database, follow these steps:

  1. Create a JDBC connection Pool, and set the non-transactional-connections attribute to true.

  2. Create a JDBC resource that uses the connection pool and note the JNDI name of the JDBC resource.

  3. Create a table named txn_log_table with the schema shown in Table 16–1.

  4. Add the db-logging-resource property to the transaction service. For example:


    asadmin set --user adminuser server.transaction-service.property.db-logging-resource="jdbc/TxnDS"

    The property's value should be the JNDI name of the JDBC resource configured previously.

  5. To disable file synchronization, use the following asadmin create-jvm-options command:


    asadmin create-jvm-options --user adminuser -Dcom.sun.appserv.transaction.nofdsync
  6. Restart the server.

For information about JDBC connection pools and resources, see Chapter 15, Using the JDBC API for Database Access. For more information about the asadmin create-jvm-options command, see the Sun Java System Application Server Platform Edition 9 Reference Manual.

Table 16–1 Schema for txn_log_table

Column Name 

JDBC Type 

LOCALTID

BIGINT

SERVERNAME

VARCHAR(n)

GTRID

VARBINARY

The size of the SERVERNAME column should be at least the length of the Application Server host name plus 10 characters.

The size of the GTRID column should be at least 64 bytes.