This section provides descriptions and examples of configuring the TimesTen JDBC driver for use with Oracle WebLogic Server 10.3.3.
Assumption: Oracle TimesTen and Weblogic Server have been successfully installed on the same host machine and that both instances are running.
Place the cursor over this icon to view images in this tutorial.
Configuring the TimesTen JDBC driver
Before you can use WebLogic Server to access the TimesTen databases, the server environment must have access to the TimesTen JDBC driver jar file and the TimesTen shared libraries. Here are the steps:
Step 1 |
Edit the <WL_install_dir>/common/bin/commEnv.sh script on UNIX/Linux or the
<WL_install_dir>/common/bin/commEnv.cmd script on Windows. Append the path to the TimesTen JDBC driver jar file to the WEBLOGIC_CLASSPATH variable defined in the file. If WebLogic Server is running JDK 1.5, use the TimesTen driver jar file at
<timesten_install_dir>/lib/ttjdbc5.jar, otherwise use the ttjdbc6.jar if WebLogic Server is using JDK 1.6.
<timesten_install_dir> is the home directory where you installed Oracle TimesTen, and <WL_install_dir> is the home directory where you installed the WebLogic Server. |
Step 2 |
Modify the LD_LIBRARY_PATH environment variable (or the equivalent variable for your OS) to include the TimesTen shared library. Append
<timesten_install_dir>/lib to the LD_LIBRARY_PATH (or equivalent) environment variable found in the
<WL_install_dir>/common/bin/commEnv.sh file.
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 WebLogic Server runs. |
Step 3 |
Restart the WebLogic 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. The table below shows the connection types and the connection properties. Each type of TimesTen JDBC driver connection requires a unique data source configuration. The examples below reference a TimesTen DSN, sampledb_1121 for direct-linked connection mode, and sampledbCS_1121 for client/server connection mode. These TimesTen DSNs need to be configured in the odbc.ini or sys.odbc.ini file on Unix/Linux platforms, or configured in the Windows Data Source Administrator.
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 WebLogic server and the TimesTen database must be running in the same machine.
TimesTen Class: com.timesten.jdbc.ObservableConnectionDS |
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 WebLogic Server. This connection type incurs distributed transaction overhead.
TimesTen Class: com.timesten.jdbc.xa.TimesTenXADataSource Example URL Property: jdbc:timesten:direct:sampledb_1121 |
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 WebLogic 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.
TimesTen Class: com.timesten.jdbc.ObservableConnectionDS Example URL Property: jdbc:timesten:client:sampledb_1121 |
Client/server access with XA distributed transactions |
The JDBC driver supports XA distributed transactions. For client/server connections, the WebLogic Server may access the TimesTen database from a remote machine.This connection type incurs network overhead in addition to the distributed transaction overhead.
TimesTen Class: com.timesten.jdbc.xa.TimesTenXADataSource Example URL Property: jdbc:timesten:client:sampledb_1121 |
A data source is usually configured using the WebLogic console. Below is a sample procedure for configuring a TimesTen data source using the WebLogic console.
1. |
Connect to the WebLogic Server Administration Console and click Data Sources |
2. |
Click New |
3. |
At the JDBC Data Source Properties screen, type a name and JNDI name for the data source. In the Database Type> and the Database drop down list boxes select Other. The screen should look similar to Figure 1 below. Figure 1 Click Next |
4. |
At the Transaction Options screen, make sure the Supports Global Transactions check box is checked. If you desire a non-XA TimesTen connection, select one of the three transaction protocol options. The screen should look similar to Figure 2 below. Figure 2 Click Next. (Note: If you desire a TimesTen XA connection, the transaction protocol options on this screen are ignored. Instead, WebLogic uses the TimesTen implementation of XAResource to control transactions.) |
5. |
At the Connection Properties screen enter a database name, host name and port. These attributes are required by WebLogic but are not used by the TimesTen JDBC driver. The screen should look similar to Figure 3 below. Figure 3 Click Next |
6. |
At the Test Database Connection screen enter the name of the TimesTen JDBC driver. If you desire a non-XA connection, specify the com.timesten.jdbc.TimesTenDriver class. If you desire a TimesTen XA connection, specify the com.timesten.jdbc.xa.TimesTenXADataSource class. Enter a TimesTen JDBC URL for the TimesTen DSN that the data source should connect to. A TimesTen URL takes the form of jdbc:timesten:[direct|client]:<DSN>.
For a direct DSN named sampledb_1121 the screen should look similar to Figure 4 below Click Next |
7. |
At the Select Targets screen, select which WebLogic servers should be associated with the data source. Click Finish. |
TimesTen Data Source Configuration Files
Every data source configured via the WebLogic console generates an XML file with the file name pattern of *-jdbc.xml in the< in the <WL_install_dir>/config/jdbc directory, where <WL_install_dir> is the directory containing the WebLogic Server domain.
Sample configuration files for the four TimesTen connection types are available at the quickstart/sample_config/j2ee_weblogic directory as shown below:
Connection Type | Sample Data Source Configuration File |
Direct-linked connections with local transactions only TimesTen Class: com.timesten.jdbc.TimesTenDriver |
SampledbDirectDS-jdbc.xml |
Direct-linked connection with XA distributed transactions TimesTen Class: com.timesten.jdbc.xa.TimesTenXADataSource |
SampledbDirectXADS-jdbc.xml |
Client/server access with local transactions only TimesTen Class: com.timesten.jdbc.TimesTenDriver |
SampledbClientDS-jdbc.xml |
Client/server access with XA distributed transactions TimesTen Class: com.timesten.jdbc.xa.TimesTenXADatatSource |
SampledbClientXADS-jdbc.xml |
To use these configuration files, follow the following steps:
- Copy the above *-jdbc.xml files to the
<wl_install_dir>/config/jdbc directory.
- Edit the <WL_install_dir>/config/config.xml, include a reference to the data source configuration file under the <domain> section.
<domain> section:
<jdbc-system-resource>
<name>SampledbDirectDS</name>
<target>AdminServer</target>
<descriptor-file-name>jdbc/SampledbDirectDS-jdbc.xml</descriptor-file-name>
</jdbc-system-resource>
Note that 'AdminServer' should be replaced with the name of your target server.
- The server should be restarted after these changes. The server will read the new configuration when it starts up and then add the data source to its JNDI tree.
Place the cursor over this icon to hide all screenshots.
Home | Site Map | Contact Us | Copyright © 2011 |