Database Configuration

From Resin 3.0

Jump to: navigation, search


Contents

Connection Configuration

The JDBC connections can be initialized with specified values of the transaction-isolation, catalog, and read-only values. The <connection> directive configures these:

resin.conf

<database jndi-name="jdbc/example">
  <driver>
    ...
  </driver>
  <connection>
    <transaction-isolation>read-committed</transaction-isolation>
    <read-only/>
  </connection>
</database>

Transaction (XA) Configuration

The <xa> directive in the <database> configuration specifies how the connections should participate in distributed transactions.

If true, connections automatically participate in any distributed transaction, i.e. a UserTransaction.begin() will enlist the connection into the new transaction and commit() will commit the transactions.

The default value is true.

Non-transactional data sources

In some cases, it is convenient to have a transactional (xa) data source and a non-transactional data source to the same database. For example, a connection that only selects data from read-only tables does not need to participate in a transaction. In that case, it is more efficient to mark the read-only connection as non-transactional by setting <xa>false</xa>

Personal tools