The transaction service writes transactional activity into transaction logs so that transactions can be recovered. You can control transaction logging in these ways:
Set the GlassFish Server's log-root setting to a shared file system base directory and set the transaction service's tx-log-dir attribute to a relative path.
Set tx-log-dir to an absolute path to a shared file system directory, in which case log-root is ignored for transaction logs.
Set a system property called TX-LOG-DIR to a shared file system directory. For example:
asadmin> create-system-properties --target server TX-LOG-DIR=/inst1/logs
For information about setting log-root and other general logging settings, see Chapter 7, Administering the Logging Service.
Turn off transaction logging by setting the disable-distributed-transaction-logging property to true and the automatic-recovery attribute to false. Do this only if performance is more important than transaction recovery.
Note - All instances in a cluster must be owned by the same user (uid), and read/write permissions for that user must be set on the transaction log directories.
Transaction logs should be stored in a high-availability network file system (NFS) to avoid a single point of failure.
For multi-core machines, logging transactions to a database may be more efficient.
This feature is intended for resource recovery on a standalone server instance while the instance is healthy, not for a server crash. It is not intended for use on a cluster.
The size of the SERVERNAME column should be at least the length of the GlassFish Server host name plus 10 characters.
The size of the GTRID column should be at least 64 bytes.
asadmin set server-config.transaction-service.property.db-logging-resource="jdbc/TxnDS"
The property's value should be the JNDI name of the JDBC resource configured previously.
asadmin create-jvm-options -Dcom.sun.appserv.transaction.nofdsync
To define the SQL used by the transaction manager when it is storing its transaction logs in the database, use the following flags:
The default statements are as follows:
-Dcom.sun.jts.dblogging.insertquery=insert into txn_log_table values ( ?, ?, ? )
-Dcom.sun.jts.dblogging.deletequery=delete from txn_log_table where localtid = ? and servername = ?
To set one of these flags using the asadmin create-jvm-options command, you must quote the statement. For example:
create-jvm-options '-Dcom.sun.jts.dblogging.deletequery=delete from txn_log_table where gtrid = ?'
You can also set JVM options in the Administration Console. Select the JVM Settings component under the relevant configuration. These flags and their statements must also be quoted in the Administration Console. For example:
'-Dcom.sun.jts.dblogging.deletequery=delete from txn_log_table where gtrid = ?'
For information about JDBC connection pools and resources, see Chapter 12, Administering Database Connectivity. For more information about the asadmin create-jvm-options command, see the Oracle GlassFish Server 3.1-3.1.1 Reference Manual.