But as stated in the Java developer's guide for TimeTen IMDB, the TimesTen driver does not implement any connection pooling. Looking at the sample code provided with the installation (TimesTenConnectionPool and TimesTenPooledConnection classes), it's clear that at the source of it is the TimesTenDataSource which is a non pooling data source. However instead of writing own code for TimesTen connection pooling, universal connection pool (UCP) could be used instead.
However could not find any Oracle documentation on UCP for TimesTen connection pooling. Therefore if there are any caveats to using UCP with TimesTen it's not known yet and post will be updated when such information comes to light.
Example java code for creating a TimesTen connection pool using UCP is as follows
String urlc = "jdbc:timesten:client:ttc_server=192.168.0.99;tcp_port=53397 ;ttc_server_dsn=bximcdb_1122;oraclePassword=asa"; // String urld = "jdbc:timesten:direct:bximcdb_1122"; PoolDataSource poolds = PoolDataSourceFactory.getPoolDataSource(); poolds.setConnectionFactoryClassName("com.timesten.jdbc.TimesTenDataSource"); // connection type determined by URL // poolds.setConnectionFactoryClassName("com.timesten.jdbc.TimesTenDriver"); // Direct connections // poolds.setConnectionFactoryClassName("com.timesten.jdbc.TimesTenClientDriver"); // client/server connections poolds.setConnectionPoolName("TTPool"); poolds.setURL(urlc); // or urld poolds.setUser("asanga"); // TT IMDB schema username poolds.setPassword("asa2"); // TT IMDB schema password poolds.setInitialPoolSize(5); poolds.setMinPoolSize(5); poolds.setMaxPoolSize(25); Connection con = poolds.getConnection(); // application work using the connectionurlc is an example of an URL used in a client/server type of connection. Usually this is when the TimeTen database and JDBC client are on two separate locations, thus connect over the network. ttc_server is the server IP or hostname where the TimesTen (TT) database is running. tcp_port is the TT listening port.
ttStatus Daemon pid 25149 port 53396 instance tt1122 TimesTen server pid 25158 started on port 53397ttc_server_dsn is the data source name setup for the TT DB. Finally the oraclePassword is the password of the corresponding Oracle database schema (not the TT DB password). Unlike the TimesTenDataSource the UCP doesn't have a "setOraclePassword" function. Therefore oracle password must be included on the URL (refer 1404604.1)
urld is an example of an URL used for direct connection to the TT DB. For this both JDBC client and TT DB must be located on the same location and does not involve a network connection.
UCP requires a connection factory class name and as shown on the example code above any one of the following TimesTenDataSource, TimesTenDriver or TimesTenClientDriver could be used. If TimesTenDataSource is used then the connection type is determined by the value on the URL (jdbc:timesten:client or jdbc:timesten:direct). Whereas other two classes explicitly specify the connection type.
The username and password set are that of the schema in the TT DB. Finally the connection pool initial, minimum and maximum sizes.
Similar to JDBC thick client TT JDBC clients also require other native libraries to be in available, and also a data source name (DSN) setup. These steps are not listed here and it is assumed all these prerequisites are completed successfully.
Running some test java code shows the connection pooled. Below is the output for client/server connection using TimesTenDataSource.
$ ttStatus Daemon pid 25149 port 53396 instance tt1122 TimesTen server pid 25158 started on port 53397 ------------------------------------------------------------------------ Data store /opt/timesten/DataStore/bximcdb_1122 There are 28 connections to the data store Shared Memory KEY 0x670615d8 ID 16482308 PL/SQL Memory KEY 0x680615d8 ID 16515077 Address 0x7fa0000000 Type PID Context Connection Name ConnID Cache Agent 25324 0x0000000002d70be0 Handler 2 Cache Agent 25324 0x0000000002ed7720 Timer 3 Cache Agent 25324 0x000000000302cc30 CacheGridRec 7 Cache Agent 25324 0x000000000309ae80 CacheGridEnv 5 Cache Agent 25324 0x0000000003235290 CacheGridSend 6 Cache Agent 25324 0x00000000032837f0 BMReporter(1107736896) 4 Cache Agent 25324 0x0000000003329920 CacheGridRec 8 Cache Agent 25324 0x000000000344edb0 CacheGridRec 9 Cache Agent 25324 0x00000000034d7390 Refresher(S,5000) 10 Cache Agent 25324 0x000000000393bc90 LogSpaceMon(1095366976) 11 Cache Agent 25324 0x0000000003b48e00 Marker(1097472320) 12 Cache Agent 25324 0x0000000011d7e150 Refresher(D,5000) 13 Server 25763 0x00000000032b0a90 java 1 (Client Information: pid: 25743; IPC: TCP/IP; Node: hpc5.domain.net (192.168.0.99)) Server 25768 0x000000001beeaa90 java 14 (Client Information: pid: 25743; IPC: TCP/IP; Node: hpc5.domain.net (192.168.0.99)) Server 25773 0x000000000daf7a90 java 15 (Client Information: pid: 25743; IPC: TCP/IP; Node: hpc5.domain.net (192.168.0.99)) Server 25778 0x0000000017887a90 java 16 (Client Information: pid: 25743; IPC: TCP/IP; Node: hpc5.domain.net (192.168.0.99)) Server 25783 0x000000001fb90a90 java 17 (Client Information: pid: 25743; IPC: TCP/IP; Node: hpc5.domain.net (192.168.0.99)) Subdaemon 25153 0x0000000001094570 Manager 142 Subdaemon 25153 0x00000000010eb3f0 Rollback 141 Subdaemon 25153 0x0000000002488580 Aging 136 Subdaemon 25153 0x000000000251d1f0 Checkpoint 133 Subdaemon 25153 0x000000000270ed90 AsyncMV 139 Subdaemon 25153 0x00000000027841b0 Log Marker 138 Subdaemon 25153 0x0000000002798da0 Deadlock Detector 137 Subdaemon 25153 0x000000000284f0e0 Flusher 140 Subdaemon 25153 0x00002aaac00008c0 Monitor 135 Subdaemon 25153 0x00002aaac0055710 HistGC 134 Subdaemon 25153 0x00002aaac00aa560 IndexGC 132 Replication policy : Manual Cache Agent policy : Manual TimesTen's Cache agent is running for this data store PL/SQL enabled. ------------------------------------------------------------------------ Accessible by group oinstall End of reportThe five pooled connections are listed as "Server" type and there are five connections which is the initial pool size.
Following is the TT status output when direct connections are used.
$ ttStatus Daemon pid 25149 port 53396 instance tt1122 TimesTen server pid 25158 started on port 53397 ------------------------------------------------------------------------ Data store /opt/timesten/DataStore/bximcdb_1122 There are 28 connections to the data store Shared Memory KEY 0x670615d8 ID 16482308 PL/SQL Memory KEY 0x680615d8 ID 16515077 Address 0x7fa0000000 Type PID Context Connection Name ConnID Cache Agent 25324 0x0000000002d70be0 Handler 2 Cache Agent 25324 0x0000000002ed7720 Timer 3 Cache Agent 25324 0x000000000302cc30 CacheGridRec 7 Cache Agent 25324 0x000000000309ae80 CacheGridEnv 5 Cache Agent 25324 0x0000000003235290 CacheGridSend 6 Cache Agent 25324 0x00000000032837f0 BMReporter(1107736896) 4 Cache Agent 25324 0x0000000003329920 CacheGridRec 8 Cache Agent 25324 0x000000000344edb0 CacheGridRec 9 Cache Agent 25324 0x00000000034d7390 Refresher(S,5000) 10 Cache Agent 25324 0x000000000393bc90 LogSpaceMon(1095366976) 11 Cache Agent 25324 0x0000000003b48e00 Marker(1097472320) 12 Cache Agent 25324 0x0000000011d7e150 Refresher(D,5000) 13 Process 25691 0x000000004a53b4f0 java 1 Process 25691 0x000000004a614820 java 14 Process 25691 0x000000004a695540 java 15 Process 25691 0x000000004a717270 java 16 Process 25691 0x000000004a798fa0 java 17 Subdaemon 25153 0x0000000001094570 Manager 142 Subdaemon 25153 0x00000000010eb3f0 Rollback 141 Subdaemon 25153 0x0000000002488580 Aging 136 Subdaemon 25153 0x000000000251d1f0 Checkpoint 133 Subdaemon 25153 0x000000000270ed90 AsyncMV 139 Subdaemon 25153 0x00000000027841b0 Log Marker 138 Subdaemon 25153 0x0000000002798da0 Deadlock Detector 137 Subdaemon 25153 0x000000000284f0e0 Flusher 140 Subdaemon 25153 0x00002aaac00008c0 Monitor 135 Subdaemon 25153 0x00002aaac0055710 HistGC 134 Subdaemon 25153 0x00002aaac00aa560 IndexGC 132 Replication policy : Manual Cache Agent policy : Manual TimesTen's Cache agent is running for this data store PL/SQL enabled. ------------------------------------------------------------------------ Accessible by group oinstall End of reportIn this case the connections are of "Process" type indicating direct connections and again there are 5 connections created against the TT DB.
The code was tested against a read only cache groups without any issues.
Useful metalink notes
How To Pass Oraclepwd Via Xml To Tomcat Server using JDBC interface? [ID 1404604.1]