Professional Documents
Culture Documents
WP Timesten70 Appsrv 128860
WP Timesten70 Appsrv 128860
0
for Application Servers and
Object-Relational Mapping
Frameworks
An Oracle White Paper
April 2008
Configuring Oracle TimesTen 7.0 for Application
Servers and Object-Relational Mapping Frameworks
Introduction ....................................................................................................... 3
TimesTen for Oracle Application Server 10g ............................................... 3
Configuring the TimesTen JDBC driver................................................... 3
Configuring connection pools and data sources...................................... 4
TimesTen for JBoss 4 .....................................................................................12
Configuring the TimesTen JDBC driver.................................................12
Configuring CMP type mappings for TimesTen ...................................13
Configuring TimesTen data sources ........................................................15
TimesTen for WebLogic Server 9.................................................................18
Configuring the TimesTen JDBC driver.................................................18
Configuring TimesTen data sources ........................................................19
TimesTen for Sun Java System Application Server 9 ................................24
Configuring the TimesTen JDBC driver.................................................25
Configuring TimesTen connections ........................................................25
Configuring a TimesTen JDBC connection pool ..................................26
Configuring a TimesTen JDBC resource ................................................28
TimesTen for WebSphere Application Server 6.........................................29
Configuring TimesTen connections ........................................................29
Configuring a TimesTen JDBC provider................................................30
Configuring TimesTen data sources ........................................................33
TimesTen for Oracle TopLink 10g ..............................................................35
Configuring the TimesTen JDBC driver for TopLink Workbench ....36
Configuring a TimesTen database login from TopLink Workbench .36
JDBC settings for the database login.......................................................37
TimesTen for Hibernate 3.2 ..........................................................................38
Configuring the TimesTen JDBC driver for Hibernate........................38
Hibernate configuration properties for TimesTen ................................39
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 2
Configuring Oracle TimesTen 7.0 for Application
Servers and Object-Relational Mapping Frameworks
INTRODUCTION
This whitepaper is for application developers who use and administer Oracle
TimesTen JDBC and for system administrators who configure and manage the
TimesTen database. It provides information about configuring your application
server and object–relational mapping framework for use with Oracle TimesTen 7.0.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 3
3. If you use OPMN (Oracle Process Manager and Notification Service) to
start the application server, the OPMN configuration file requires
modification to include the location of the TimesTen shared libraries. The
OPMN configuration file is located at
Oracle_install_dir/opmn/conf/opmn.conf.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 4
Direct access connection pool (local transactions only)
TimesTen Class: com.timesten.jdbc.TimesTenDriver
Example URL: jdbc:timesten:direct:RunData_tt70
Figure 1.1 Example of the OM configuration page for Direct Access Connection Pool – local
transactions only
Example Oracle_install_dir/j2ee/home/config/data-
sources.xml entry:
<connection-pool name="TimesTenDirectPool">
<connection-factory factory-class="com.timesten.jdbc.TimesTenDriver"
url="jdbc:timesten:direct:RunData_tt70"/>
</connection-pool>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 5
Direct access data source (local transactions only)
Figure 1.2 Example of the OM configuration page for direct access data source – local transactions
only
Example Oracle_install_dir/j2ee/home/config/data-
sources.xml entry:
<managed-data-source connection-pool-name="TimesTenDirectPool"
jndi-name="jdbc/TimesTenDirectDS" name="TimesTenDirectDS"
tx-level="local"/>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 6
Example URL: jdbc:timesten:direct:RunData_tt70
Figure 1.3 Example of the OM configuration page for direct access connection pool – local and
distributed XA transactions
Example Oracle_install_dir/j2ee/home/config/data-
sources.xml entry:
<connection-pool name="TimesTenDirectXAPool">
<connection-factory factory-
class="com.timesten.jdbc.xa.TimesTenXADataSource"
url="jdbc:timesten:direct:RunData_tt70"/>
</connection-pool>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 7
Direct access data source (local & distributed XA transactions)
Figure 1.4 Example of the OM configuration page for direct access data source – local and distributed
XA transactions
Example Oracle_install_dir/j2ee/home/config/data-
sources.xml entry:
<managed-data-source connection-pool-name="TimesTenDirectXAPool" jndi-
name="jdbc/TimesTenDirectXADS" name="TimesTenDirectXADS"/>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 8
Example URL: jdbc:timesten:client:RunDataCS_tt70
Figure 1.5 Example of the OM configuration page for Client/Server access connection pool – local
transactions only
Example Oracle_install_dir/j2ee/home/config/data-
sources.xml entry:
<connection-pool name="TimesTenClientPool">
<connection-factory factory-class="com.timesten.jdbc.TimesTenDriver"
url="jdbc:timesten:client:RunDataCS_tt70"/>
</connection-pool>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 9
Client/server Access Data Source (Local Transactions Only)
Figure 1.6 Example of the OM configuration page for Client/Server access data source – local
transactions only
Example Oracle_install_dir/j2ee/home/config/data-
sources.xml entry:
<managed-data-source connection-pool-name="TimesTenClientPool" jndi-
name="jdbc/TimesTenClientDS" name="TimesTenClientDS" tx-level="local"/>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 10
Figure 1.7 Example of the OM configuration page for Client/Server access connection pool – local &
distributed XA transactions
Example Oracle_install_dir/j2ee/home/config/data-
sources.xml entry:
<connection-pool name="TimesTenClientXAPool">
<connection-factory factory-
class="com.timesten.jdbc.xa.TimesTenXADataSource"
url="jdbc:timesten:client:RunDataCS_tt70"/>
</connection-pool>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 11
Client/server access data source (local & distributed XA transactions)
Figure 1.8 Example of the OM configuration page for Client/Server access data source – local &
distributed XA transactions
Example Oracle_install_dir/j2ee/home/config/data-
sources.xml entry:
<managed-data-source connection-pool-name="TimesTenClientXAPool" jndi-
name="jdbc/TimesTenClientXADS" name="TimesTenClientXADS"/>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 12
Windows, set the PATH environment variable to the
install_dir/bin directory where the TimesTen DLLs are located.
This variable must be set for the environment where JBoss runs.
3. Restart the JBoss server for the changes to take effect.
<name>TimesTen</name>
<row-locking-template>
SELECT ?1 FROM ?2 WHERE ?3 FOR UPDATE
</row-locking-template>
<pk-constraint-template>PRIMARY KEY (?2)</pk-constraint-template>
<fk-constraint-template>
ALTER TABLE ?1 ADD CONSTRAINT ?2 FOREIGN KEY (?3) REFERENCES ?4
(?5)
</fk-constraint-template>
<add-column-template>
ALTER TABLE ?1 ADD COLUMN ?2 ?3
</add-column-template>
<drop-column-template>
ALTER TABLE ?1 DROP COLUMN ?2
</drop-column-template>
<alias-header-prefix>t</alias-header-prefix>
<alias-header-suffix>_</alias-header-suffix>
<alias-max-length>30</alias-max-length>
<subquery-supported>true</subquery-supported>
<true-mapping>(1=1)</true-mapping>
<false-mapping>(1=0)</false-mapping>
<function-mapping>
<function-name>concat</function-name>
<function-sql>CONCAT (?1, ?2)</function-sql>
</function-mapping>
<function-mapping>
<function-name>substring</function-name>
<function-sql>SUBSTRING (?1, ?2, ?3)</function-sql>
</function-mapping>
<function-mapping>
<function-name>lcase</function-name>
<function-sql>LOWER (?1)</function-sql>
</function-mapping>
<function-mapping>
<function-name>length</function-name>
<function-sql>LENGTH (?1)</function-sql>
</function-mapping>
<function-mapping>
<function-name>locate</function-name>
<function-sql>INSTR (?2, ?1, ?3)</function-sql>
</function-mapping>
<function-mapping>
<function-name>ucase</function-name>
<function-sql>UPPER (?1)</function-sql>
</function-mapping>
<function-mapping>
<function-name>count</function-name>
<function-sql>COUNT (?1)</function-sql>
</function-mapping>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 13
<mapping>
<java-type>java.lang.Boolean</java-type>
<jdbc-type>TINYINT</jdbc-type>
<sql-type>TT_TINYINT</sql-type>
</mapping>
<mapping>
<java-type>java.lang.Byte</java-type>
<jdbc-type>TINYINT</jdbc-type>
<sql-type>TT_TINYINT</sql-type>
</mapping>
<mapping>
<java-type>java.lang.Short</java-type>
<jdbc-type>SMALLINT</jdbc-type>
<sql-type>TT_SMALLINT</sql-type>
</mapping>
<mapping>
<java-type>java.lang.Integer</java-type>
<jdbc-type>INTEGER</jdbc-type>
<sql-type>INTEGER</sql-type>
</mapping>
<mapping>
<java-type>java.lang.Long</java-type>
<jdbc-type>BIGINT</jdbc-type>
<sql-type>TT_BIGINT</sql-type>
</mapping>
<mapping>
<java-type>java.lang.Float</java-type>
<jdbc-type>REAL</jdbc-type>
<sql-type>BINARY_FLOAT</sql-type>
</mapping>
<mapping>
<java-type>java.math.BigDecimal</java-type>
<jdbc-type>DECIMAL</jdbc-type>
<sql-type>DECIMAL (38,15)</sql-type>
</mapping>
<mapping>
<java-type>java.lang.Double</java-type>
<jdbc-type>DOUBLE</jdbc-type>
<sql-type>BINARY_DOUBLE</sql-type>
</mapping>
<mapping>
<java-type>java.lang.Character</java-type>
<jdbc-type>CHAR</jdbc-type>
<sql-type>CHARACTER</sql-type>
</mapping>
<mapping>
<java-type>java.lang.String</java-type>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR (256)</sql-type>
</mapping>
<mapping>
<java-type>java.sql.Date</java-type>
<jdbc-type>DATE</jdbc-type>
<sql-type>DATE</sql-type>
</mapping>
<mapping>
<java-type>java.sql.Time</java-type>
<jdbc-type>TIME</jdbc-type>
<sql-type>TT_TIME</sql-type>
</mapping>
<mapping>
<java-type>java.sql.Timestamp</java-type>
<jdbc-type>TIMESTAMP</jdbc-type>
<sql-type>TIMESTAMP</sql-type>
</mapping>
<mapping>
<java-type>java.lang.Object</java-type>
<!-- directly serializable objects -->
<jdbc-type>VARBINARY</jdbc-type>
<sql-type>VARBINARY (4194304)</sql-type>
</mapping>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 14
</type-mapping>
TimesTen 7.0 operates in two distinct SQL type modes: Oracle type mode and
TimesTen type mode. The example type mapping definition operates in either
mode. However, it may be appropriate to modify the mappings to completely
conform to one of the two modes or to improve performance for a particular
application.
To configure the JBoss server to access the example TimesTen type mapping
definition, copy the complete definition into the <type-mappings> section of the
JBOSS_install_dir/server/default/conf/standardjbosscmp-
jdbc.xml configuration file.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 15
Example 2.2 Example of the deployment descriptor file, it includes 4 distinct types of connections
that can be configured for TimesTen
<datasources>
<local-tx-datasource>
<jndi-name>RunDataDirectDS</jndi-name>
<connection-url>jdbc:timesten:RunData_tt70</connection-url>
<driver-class>com.timesten.jdbc.TimesTenDriver</driver-class>
<user-name></user-name>
<password></password>
<transaction-isolation>
TRANSACTION_READ_COMMITTED
</transaction-isolation>
<!--pooling parameters-->
<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<local-tx-datasource>
<jndi-name>RunDataClientDS</jndi-name>
<connection-url>
jdbc:timesten:client:RunDataCS_tt70
</connection-url>
<driver-class>com.timesten.jdbc.TimesTenDriver</driver-class>
<user-name></user-name>
<password></password>
<transaction-isolation>
TRANSACTION_READ_COMMITTED
</transaction-isolation>
<!--pooling parameters-->
<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 16
<new-connection-sql>SELECT * FROM SYS.TABLES</new-connection-sql>
<check-valid-connection-sql>
SELECT * FROM SYS.TABLES
</check-valid-connection-sql>
-->
<xa-datasource>
<jndi-name>RunDataDirectXADS</jndi-name>
<xa-datasource-class>
com.timesten.jdbc.xa.TimesTenXADataSource
</xa-datasource-class>
<xa-datasource-property name="Url">
jdbc:timesten:RunData_tt70
</xa-datasource-property>
<user-name></user-name>
<password></password>
<transaction-isolation>
TRANSACTION_READ_COMMITTED
</transaction-isolation>
<!--pooling parameters-->
<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<xa-datasource>
<jndi-name>RunDataClientXADS</jndi-name>
<xa-datasource-class>
com.timesten.jdbc.xa.TimesTenXADataSource
</xa-datasource-class>
<xa-datasource-property name="Url">
jdbc:timesten:client:RunDataCS_tt70
</xa-datasource-property>
<user-name></user-name>
<password></password>
<transaction-isolation>
TRANSACTION_READ_COMMITTED
</transaction-isolation>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 17
<!--pooling parameters-->
<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
</datasources>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 18
variable in the WL_install_dir/common/bin/commEnv.sh file.
On Windows platforms, append the PATH environment variable with the
install_dir/bin directory where TimesTen DLLs are located.
3. After completing these steps you must restart the WebLogic Server for the
changes to take effect.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 19
Figure 3.1 JDBC Data source properties screen
Click Next.
4. At the Transaction Options screen, make sure that 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 3.2.
Figure 3.2 Transaction Options screen
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 20
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.3.
Figure 3.3 Connection Properties screen
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:
jdbc:timesten:[direct|client]:DSN. For a direct DSN
named RunData_tt70 the screen should look similar to figure 3.4.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 21
Figure 3.4 Test Database Connection screen
Click Next.
7. At the Select Targets screen, select which WebLogic servers should be
associated with the data source. Click Finish.
8. Click Activate Changes to complete the configuration.
When a data source is configured in the WebLogic console an XML file with the
name pattern of *-jdbc.xml is created in the
WL_domain_dir/config/jdbc directory, where WL_domain_dir is the
directory containing the WebLogic Server domain. Sample configuration files for
the four different types of TimesTen connections are listed below. To use these
configuration files, download them from
http://www.oracle.com/technology/products/timesten/sample_code and then
copy them to the WL_domain_dir/config/jdbc directory. The
WL_domain_dir/config/config.xml file must also be edited to include a
reference to the data source configuration file. For example if you use the
RunDataDirectDS-jdbc.xml file, the
WL_domain_dir/config/config.xml includes an entry like this in the
<domain> section:
<jdbc-system-resource>
<name>RunDataDirectDS</name>
<target>AdminServer</target>
<descriptor-file-name>jdbc/RunDataDirectDS-jdbc.xml
</descriptor-file-name>
</jdbc-system-resource>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 22
Direct access data source (non-XA local transactions)
TimesTen Class: com.timesten.jdbc.TimesTenDriver
Example URL: jdbc:timesten:direct:RunData_tt70
Example Data Source Configuration File: RunDataDirectDS-jdbc.xml
Figure 3.5 Example data source configuration file
<?xml version="1.0" encoding="UTF-8" ?>
- <jdbc-data-source xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:sec="http://www.bea.com/ns/weblogic/90/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/920
http://www.bea.com/ns/weblogic/920.xsd">
<name>RunDataDirectDS</name>
- <jdbc-driver-params>
<url>jdbc:timesten:direct:RunData_tt70</url>
<driver-name>com.timesten.jdbc.TimesTenDriver</driver-name>
</jdbc-driver-params>
- <jdbc-connection-pool-params>
<test-table-name>dual</test-table-name>
</jdbc-connection-pool-params>
- <jdbc-data-source-params>
<jndi-name>jdbc/RunDataDirectDS</jndi-name>
<row-prefetch>true</row-prefetch>
<global-transactions-protocol>OnePhaseCommit</global-transactions-
protocol>
</jdbc-data-source-params>
</jdbc-data-source>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 23
Example Data Source Configuration File: RunDataClientDS-jdbc.xml
Figure 3.7 Example data source configuration file
<?xml version="1.0" encoding="UTF-8" ?>
- <jdbc-data-source xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:sec="http://www.bea.com/ns/weblogic/90/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/920
http://www.bea.com/ns/weblogic/920.xsd">
<name>RunDataClientDS</name>
- <jdbc-driver-params>
<url>jdbc:timesten:client:RunDataCS_tt70</url>
<driver-name>com.timesten.jdbc.TimesTenDriver</driver-name>
</jdbc-driver-params>
- <jdbc-connection-pool-params>
<test-table-name>dual</test-table-name>
</jdbc-connection-pool-params>
- <jdbc-data-source-params>
<jndi-name>jdbc/RunDataClientDS</jndi-name>
<global-transactions-protocol>OnePhaseCommit</global-transactions-
protocol>
</jdbc-data-source-params>
</jdbc-data-source>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 24
Configuring the TimesTen JDBC driver
Before you can use Sun Java System Application Server (Sun AS) to access
TimesTen databases, the server environment must have access to the TimesTen
JDBC driver jar file and the native TimesTen libraries.
1. Copy one of the TimesTen JDBC driver jar files from
install_dir/lib to the SunAS_install_dir/lib/ext
directory. If Sun AS is using JDK 1.4, copy the
install_dir/lib/ttjdbc14.jar file. If Sun AS is using JDK
1.5, copy the install_dir/lib/ttjdbc5.jar file.
The TimesTen JDBC driver supports four different types of database connections.
• Direct access with local transactions only – This configuration provides
the fastest database performance. The TimesTen data store must reside on
the same machine as TimesTen and Sun AS.
• Direct access with XA distributed transaction support - The driver
supports distributed transactions. The TimesTen data store must reside on
the same machine as TimesTen and Sun AS.
• Client/server access with local transactions only - The TimesTen data
store may reside on a remote machine that is running the TimesTen server.
• Client/server access with XA distributed transaction support - The
driver supports distributed transactions. The TimesTen data store may
reside on a remote machine that is running the TimesTen server.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 25
Example URL Property: jdbc:timesten:direct:RunData_tt70
Direct access with XA distributed transaction support:
TimesTen Class: com.timesten.jdbc.xa.TimesTenXADataSource
Example URL Property: jdbc:timesten:direct:RunData_tt70
Client/server access with local transactions only:
TimesTen Class: com.timesten.jdbc.ObservableConnectionDS
Example URL Property: jdbc:timesten:client:RunDataCS_tt70
Client/server access with XA distributed transaction support:
TimesTen Class: com.timesten.jdbc.xa.TimesTenXADataSource
Example URL Property: jdbc:timesten:client:RunDataCS_tt70
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 26
Figure 4.1 New Connection Pool Screen
Click Next.
5. At the New Connection Pool (Step 2 of 2) screen enter
com.timesten.jdbc.ObservableConnectionDS in the Datasource
Classname field for local transactions. Enter
com.timesten.jdbc.xa.TimesTenXADataSource if XA
distributed transactions are required.
6. Scroll down to the Properties section at the bottom of the screen. Click
Add. A new row will appear in the Properties section of the screen. Click
the check box in the new row. Type 'url' in the Name column. In the
Value column enter the TimesTen URL for the data store to which this
pool should connect. A TimesTen URL takes the form:
jdbc:timesten:[direct|client]:DSN. For a direct DSN
named RunData_tt70 the screen should look similar to figure 4.2.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 27
Figure 4.2 Properties screen
Click Finish.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 28
Figure 4.3 JDBC Resources screen
Click OK.
The TimesTen JDBC driver supports four different types of database connections.
• Direct access with local transactions only - This configuration provides
the fastest database performance. The TimesTen data store must reside on
the same machine as TimesTen and WebSphere.
• Direct access with XA distributed transaction support - The driver
supports distributed transactions. The TimesTen data store must reside on
the same machine as TimesTen and WebSphere.
• Client/server access with local transactions only - The TimesTen data
store may reside on a remote machine that is running the TimesTen server.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 29
• Client/server access with XA distributed transaction support - The
driver supports distributed transactions. The TimesTen data store may
reside on a remote machine that is running the TimesTen server.
Properties of TimesTen connections
When configuring TimesTen connections in WebSphere use the following settings.
Direct access with local transactions only:
TimesTen Class: com.timesten.jdbc.ObservableConnectionDS
Example URL Property: jdbc:timesten:direct:RunData_tt70
Direct access with XA distributed transaction support:
TimesTen Class: com.timesten.jdbc.xa.TimesTenXADataSource
Example URL Property: jdbc:timesten:direct:RunData_tt70
Client/server access with local transactions only:
TimesTen Class: com.timesten.jdbc.ObservableConnectionDS
Example URL Property: jdbc:timesten:client:RunDataCS_tt70
Client/server access with XA distributed transaction support:
TimesTen Class: com.timesten.jdbc.xa.TimesTenXADataSource
Example URL Property: jdbc:timesten:client:RunDataCS_tt70
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 30
Figure 5.1 Create new JDBC provider screen
Click Next.
6. At the Enter database class path information screen enter the path to
the TimesTen JDBC driver. If WebSphere is running JDK 5, use the
TimesTen driver jar file at install_dir/lib/ttjdbc5.jar.
Otherwise use the JDK 1.4 jar file at
install_dir/lib/ttjdbc14.jar, where install_dir is the
directory in which you installed Oracle TimesTen. The screen should look
similar to figure 5.2.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 31
Figure 5.2 Enter database class path information screen
Click Next.
7. On the summary screen click Finish.
8. At the JDBC providers screen click the provider name that you just
created.
9. At the General properties screen enter the path to the TimesTen shared
libraries in the Native library path field. On UNIX platforms the path is
install_dir/lib. On Windows platforms the path is
install_dir/bin. The screen should look similar to figure 5.3.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 32
Figure 5.3 General properties screen
Click Apply.
10. Click Save to save the new configuration.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 33
8. On the following summary screen click Finish.
9. At the Data sources screen click on the name of the TimesTen data
source that you just created.
10. Click Custom properties.
11. Click url property.
12. In the value field enter the TimesTen JDBC URL for the DSN that this
data source should connect to. A TimesTen URL takes the form:
jdbc:timesten:<direct|client>:<DSN>. For a direct DSN
named RunData_tt70 the screen should look similar to figure 5.4.
Figure 5.4 Data Sources screen
Click Apply.
13. Click Save to save the new configuration.
14. Restart the server before attempting to make connections to the new
TimesTen data source.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 34
Troubleshooting TimesTen connections
Various problems may occur when using TimesTen with WebSphere. The list below
describes possible solutions for common problems.
1. When clicking on Test Connection for a TimesTen data source on the
Data sources screen of the administration console, TimesTen throws a
java.lang.IllegalAccessError exception. This problem can
occur if you have configured a new TimesTen data source but have not
restarted the server. Try restarting the server to solve the problem.
2. When attempting to establish a connection to a TimesTen data source
from within WebSphere, TimesTen throws the exception “TT0837:
Cannot attach data store shared-memory segment.” This problem is likely
to occur on 32-bit platforms when the system is unable to allocate or map
enough contiguous shared memory to hold the TimesTen data store. For
detailed instructions on how to resolve this and other connection problems
see the Oracle TimesTen In-Memory Database Troubleshooting Procedures Guide
and the Oracle TimesTen In-Memory Database Installation Guide. These
troubleshooting steps are recommended.
a. Verify that it is possible to connect to the TimesTen data store
outside of the WebSphere JVM. You can use the ttIsql utility for
this purpose.
b. Try increasing the maximum amount of shared memory available
to the system. See the Oracle TimesTen In-Memory Database
Installation Guide for platform specific details.
c. Try decreasing the size of the TimesTen data store by recreating
the data store with lower values for the PermSize and TempSize
connection attributes.
d. Terminate any unnecessary processes on the system to make more
memory available.
e. Try a client/server TimesTen JDBC connection instead of a direct
connection for the WebSphere data source.
f. If possible try a 64-bit version of TimesTen and WebSphere.
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 35
Configuring the TimesTen JDBC driver for TopLink Workbench
DRIVER_CLASSPATH=/opt/TimesTen/tt70/lib/ttjdbc5.jar; export
DRIVER_CLASSPATH
LD_LIBRARY_PATH=/opt/TimesTen/tt70/lib; export LD_LIBRARY_PATH
JAVA_HOME=/usr/java/jdk1.5.0_09; export JAVA_HOME
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 36
Figure 6.1 Database Login screen
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 37
Figure 6.2 JDBC Options for Database Login
These properties may also be set manually within the sessions.xml or in the
toplink-ejb-jar.xml configuration files as shown below.
<toplink:login xsi:type="toplink:database-login">
<toplink:platform-class>oracle.toplink.platform.database.TimesTenPlatform</toplink:platform-class>
<toplink:user-name></toplink:user-name>
<toplink:password></toplink:password>
<toplink:driver-class>com.timesten.jdbc.TimesTenDriver</toplink:driver-class>
<toplink:connection-url>jdbc:timesten:direct:RunData_tt70</toplink:connection-url>
<toplink:bind-all-parameters>true</toplink:bind-all-parameters>
<toplink:cache-all-statements>true</toplink:cache-all-statements>
<toplink:batch-writing>true</toplink:batch-writing>
<toplink:jdbc-batch-writing>true</toplink:jdbc-batch-writing>
</toplink:login>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 38
file. When using JDK 1.4 add install_dir/lib/ttjdbc14.jar to the
CLASSPATH. When using JDK 5 add the
install_dir/lib/ttjdbc5.jar file to the CLASSPATH, where
install_dir is the directory in which you installed Oracle TimesTen.
Set the LD_LIBRARY_PATH (or equivalent for your OS) environment variable to
include the path to the TimesTen shared libraries located at install_dir/lib.
On Windows platforms the PATH environment variable should be set to the
install_dir/bin directory where TimesTen DLLs are located.
A new Hibernate dialect class called
org.hibernate.dialect.TimesTen7Dialect has been developed for
use with TimesTen version 7. This dialect is optimized for the latest SQL features of
TimesTen and it is the recommended Hibernate dialect for TimesTen 7
applications. This dialect is not included in current versions of the Hibernate
distribution. It is included in the TimesTen installation as of TimesTen version
7.0.5. The java source code for the dialect is located in the
install_dir/demo/appserver/config/hibernate3 directory of
the TimesTen installation. For an example of how to build and package this dialect
class using the Ant build tool see the
install_dir/demo/appserver/build-hibernate3.xml build file
in the TimesTen 7.0.5 or greater installation.
The following property values are recommended when using TimesTen with
Hibernate:
hibernate.connection.isolation=2
hibernate.jdbc.use_get_generated_keys=false
hibernate.jdbc.use_scrollable_resultset=false
hibernate.jdbc.batch_size=256
<hibernate-configuration>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 39
<session-factory name="RunData_tt70">
<property
name="hibernate.dialect">org.hibernate.dialect.TimesTen7Dialect</propert
y>
<!-- Connection.TRANSACTION_READ_COMMITTED = 2 -->
<property name="hibernate.connection.isolation">2</property>
<property name="hibernate.jdbc.fetch_size">32</property>
<property name="hibernate.jdbc.batch_size">256</property>
<property name="hibernate.jdbc.batch_versioned_data">true</property>
<property name="hibernate.jdbc.use_streams_for_binary">false</property>
<property name="hibernate.jdbc.use_get_generated_keys">false</property>
<property
name="hibernate.jdbc.use_scrollable_resultset">false</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="hibernate.cache.use_second_level_cache">false</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.connection.pool_size">4</property>
</session-factory>
</hibernate-configuration>
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks Page 40
Configuring Oracle TimesTen 7.0 for Application Servers and Object-Relational Mapping Frameworks
April 2008
Oracle Corporation
World Headquarters
500 Oracle Parkway
Redwood Shores, CA 94065
U.S.A.
Worldwide Inquiries:
Phone: +1.650.506.7000
Fax: +1.650.506.7200
oracle.com