Below are the steps required to set up the TimesTen example: create the database, add schema and data, and deploy and undeploy the example service.

Creating a database

The resource adaptor configuration in the example expects two DSNs to be available: mappingsCS1 and mappingsCS2. For the TimesTen Client, this could be a working configuration:

.odbc.ini
[ODBC Data Sources]
mappingsCS1=TimesTen 11.2.1 Client Driver
mappingsCS2=TimesTen 11.2.1 Client Driver

[mappingsCS1]
TTC_SERVER=server1
TTC_SERVER_DSN=mappings

[mappingsCS2]
TTC_SERVER=server2
TTC_SERVER_DSN=mappings

Each server would then also need a DSN named mappings.

The server data sources need a user created. The examples use a user ID of appuser with password appuser (can be changed in build.properties).

Schema and data

The SQL below must be applied to the specified data sources to create the table, insert a row into it, and define the test procedure used in the example.

examples/src/com/opencloud/slee/test/dbquery/TimesTenTestDB.sql
DROP TABLE mappings;

CREATE TABLE mappings (
  short_code VARCHAR(10) PRIMARY KEY,
  long_code VARCHAR(64) NOT NULL
);

INSERT INTO mappings (short_code, long_code) VALUES ('0000', '11111111111');
COMMIT;

CREATE OR REPLACE PROCEDURE EXTEND_LONG_CODE_WITH_PREFIX(
    p_concat OUT mappings.long_code%TYPE,
    p_short_code IN mappings.short_code%TYPE,
    p_prefix IN mappings.long_code%TYPE)
AS
BEGIN
    SELECT concat(p_prefix, long_code)
      INTO p_concat
      FROM mappings
     WHERE short_code = p_short_code;

    UPDATE mappings
       SET long_code = p_concat
     WHERE short_code = p_short_code;
END;
/

Deploying the example service

Before starting Rhino, LD_LIBRARY_PATH needs to be set as described in the last section of Deploying the resource adaptor.

Then, timesten.jdbc.dir and client.home must be set in the build.properties and examples/build.properties files respectively.

The build target deploy-timesten-example of examples/timesten.build.xml will deploy the DB Query RA, the Example RA, and the example service.

Undeploying the example service

The build target undeploy-timesten-example of examples/timesten.build.xml will undeploy the example service, the DDB Query RA, and the Example RA.

Warning After undeploying the TimesTen version of the RA, a Rhino restart is needed before it can be deployed again. This is because it uses the TimesTen native library.
Previous page