A.2.4. The JDBC Store

The JDBCStore implementation stores persistent object states in a JDBC database. Nested transaction support is available when the JBDCStore is used in conjunction with the Transactional Objects for Java API. All object states are stored as Binary Large Objects (BLOBs) within a single table. Object state size is limited to 64k. If you try to store an object state which exceeds this limit, an exception is thrown and the state is not stored. The transaction is forced to roll back.
When using the JDBC object store, the application needs to provide an implementation of the JDBCAccess interface, located in the com.arjuna.ats.arjuna.objectstore package. See the Example A.2, “JDBCAccess Implementation Example”.

Example A.2. JDBCAccess Implementation Example

	  public interface JDBCAccess
	  {
	  public Connection getConnection () throws SQLException;
	  public void putConnection (Connection conn) throws SQLException;
	  public void initialise (ObjectName objName);
	  }
The implementation of the JDBCAccess class provides the Connection used by the JDBC ObjectStore to save and restore object states. Refer to JDBCAccess Connection Methods for details.

JDBCAccess Connection Methods

getConnection
Returns the Connection to use. This method will be called whenever a connection is required and the implementation should use whatever policy is necessary for determining what connection to return. This method need not return the same Connection instance more than once.
putConnection
Returns one of the Connections acquired from getConnection. Connections are returned if any errors occur when using them.
initialise
Passes additional arbitrary information to the implementation.
The JDBC object store initially requests the number of Connections defined in the com.arjuna.ats.arjuna.objectstore.jdbcPoolSizeInitial property, and uses no more than defined in the com.arjuna.ats.arjuna.objectstore.jdbcPoolSizeMaximum property.
The implementation of the JDBCAccess interface to use should be set in the com.arjuna.ats.arjuna.objectstore.jdbcUserDbAccess property variable.
The type of this object store is JDBCStore.
A JDBC object store can manage the transaction log. The transaction log implementation should be set to JDBCActionStore, and the JDBCAccess method should be provided via the com.arjuna.ats.arjuna.objectstore.jdbcTxDbAccess property. The default table name is JBossTSTxTable.

Note

You can use the same JDBCAccess implementation for both the user object store and the transaction log.