How to Configure JBoss Application Server 5.1.0

This section provides descriptions and examples of configuring the TimesTen JDBC driver for use with JBoss Application Server 5.1.0.

Assumption: Oracle TimesTen and JBoss Application Server have been successfully installed on the same host machine and that both instances are running.

Configuring the TimesTen JDBC driver

Before you can use JBoss Application Server to access the TimesTen databases, the JBoss server environment must have access to the TimesTen JDBC driver jar file and the TimesTen shared libraries. Here are the steps:

Step 1
Copy one of the TimesTen JDBC driver jar files from your TimesTen install directory <TimesTen_install_dir>/lib to <JBoss_server_dir>/lib. If JBoss is using JDK 1.5, copy the ttjdbc5.jar file, otherwise copy the ttjdbc6.jar if JBoss is using JDK 1.6.

<JBoss_server_dir> is the location of the target JBoss server in which you run your applications. If you use the default server, it should be <JBoss_install_dir>/server/default. <JBoss_install_dir> is the home directory where you installed the JBoss Application Server.

<TimesTen_install_dir> is the home directory where you installed Oracle TimesTen.

Step 2
Set the LD_LIBRARY_PATH environment variable (or the equivalent variable for your OS) to include the TimesTen lib directory <TimesTen_install_dir>/lib.

On Windows, set the PATH environment variable to include the <TimesTen_install_dir>/bin directory where the TimesTen DLLs are located. The PATH variable must be set for the environment where JBoss Application Server runs.

Step 3

Configure CMP type mappings for TimesTen

In order for TimesTen to work with various features of Container Managed Persistence (CMP) in JBoss Application Server, a JDBC to SQL type mapping definition is used.

Here's an example of type mapping definition for TimesTen 11.2.2. You can also access the file from <TimesTen_install_dir>/quickstart/sample_config/j2ee_jboss/timesten-type-mapping.xml

To configure the JBoss server to access the sample TimesTen type mapping definition, copy the complete definition into the <type-mappings> section of the <JBoss_server_dir>/conf/standardjbosscmp-jdbc.xml configuration file.

Step 4
Restart the JBoss server for the changes to take effect

Configuring TimesTen data sources

The TimesTen JDBC driver supports four different types of connections to access the TimesTen database:

Direct-linked connections with local transactions only
This configuration is an in-process linked to the TimesTen database libraries; direct-linked connection provides the best response time for database operations and results in higher transaction throughput. To use this configuration, the JBoss application server and the TimesTen database need to be running in the same machine.
Direct-linked connection with XA distributed transactions
The JDBC driver supports XA distributed transactions. For directed-link connections, the TimesTen database must reside on the same machine as the JBoss Application Server. This connection incurs distributed transaction overhead.
Client/server access with local transactions only
Client/Server connections are intended for applications not running in the same machine as the TimesTen database. Here, the JBoss Application Server can access the TimesTen database from a remote machine. This connection mode incurs network (TCP/IP) overhead and is less responsive as the direct-linked connection mode.
Client/server access with XA distributed transactions
The JDBC driver supports XA distributed transactions. For client/server connections, the JBoss Application Server may access the TimesTen database from a remote machine.This connection mode incurs network overhead in addition to the distributed transaction overhead.

Each type of TimesTen JDBC driver connection requires a unique data source configuration in JBoss. A data source deployment descriptor file is named using a *-ds.xml pattern and is placed in the deploy directory of the JBoss server

Here's a sample deployment descriptor file (timesten-ds.xml). You may copy it from <TimesTen_install_dir>/quickstart/sample_config/j2ee_jboss/timesten-ds.xml

This timesten-ds.xml file defines all four types of TimesTen data sources. The file references a TimesTen direct access DSN named sampledb_1122 and a client/server access DSN named sampledbCS_1122. These TimesTen DSNs must be configured in the odbc.ini or sys.odbc.ini file or in the Windows Data Source Administrator before the examples can work. Place the file in the <JBoss_server_dir>/deploy directory and restart the JBoss server to allow applications to connect to the TimesTen database.