Compile and Run application with WebSphere Applicaton Server


1. Set up environment to compile and run the sample application

The following script must be run for each of the terminal session:

Windows:   > quickstart/ttquickstartenv.bat
Unix/Linux:   $ . quickstart/ OR
$ source quickstart/ttquickstartenv.csh

2. Set up sample database, user accounts and the TPTBM table

The following command should be run once to set up the sample database, user accounts and the TPTBM table.

Windows or Unix/Linux:   > cd quickstart/sample_code/j2ee_orm
> ttIsql -connStr "DSN=sampledb_1122" -f tptbm.sql

3. If necessary, install the Apache Ant build tool.

For each application server, an Ant build script is provided to configure, build and execute the application based on the properties of the applicaton server installation. The Apache Ant build tool has to be installed if not present.

After installation, make sure the Operating System environment variable PATH includes the path to the 'ant' executable.

The Ant build scripts have been tested with Apache Ant version 1.9.2.



1. install WebSphere Application Server and configure

Install WebSphere Application Server 8.5 and then set the following properties in file quickstart/sample_code/j2ee_orm/

    websphere.home.dir      -- set this to the home (WAS_HOME) installation 
                               directory of the local WebSphere server 

    websphere.profile.dir   -- set this to the profile directory for the 
                               WebSphere server that will deploy the Tptbm 

    websphere.cell          -- set this to the the name of the WebSphere 
                               cell that will run the Tptbm EJB          -- the name of the host machine running the 
                               WebSphere application server

    websphere.port          -- the RMI port number used by clients to 
                               communicate with the server, the default port
                               number is 2809
Each Ant build script reads values from file quickstart/sample_code/j2ee_orm/ This file specifies the locations of build dependencies including the location of the application server installation. This file also specifies the common benchmark execution parameters.

2. TimesTen Data Source

Before the application can be deployed or executed, a TimesTen data source with the JNDI name of jdbc/TbtbmDS must be configured on the server. This can be done from a web browser by configuring a JDBC Provider resource for TimesTen within the WebSphere Administrative Console. Follow these steps to configure the TimesTen data source:

  1. Login to the WebSphere Administrative Console from a web browser. The default URL for this is 'http://localhost:9060/ibm/console'.

  2. Select Resources->JDBC->JDBC Providers from the left hand panel.

  3. Select a scope from the drop down list box.

  4. Click the New button to create a new JDBC Provider. In the 'Database type' list box select 'User-defined'.
    In the 'Implementation class name' field specify 'com.timesten.jdbc.ObservableConnectionDS'.
    In the 'Name' field type 'TimesTen JDBC Provider'.
    Click the Next button.

  5. In the 'Class path' field specify the complete path to the TimesTen JDBC driver jar file, for example: 'C:\TimesTen\tt1122_64\lib\ttjdbc6.jar'.
    Click the Next button and then click the Finish button at the summary screen.

  6. Click the name of the TimesTen JDBC provider that was just created. In the 'Native library path' field specify the directory where the TimesTen shared libraries are located, for example: 'C:\TimesTen\tt1122_64\bin'.
    Click the Apply button.
    Click the Save link to save the configuration.

  7. Select Resources->JDBC->Data sources from the left hand panel.

  8. Select a scope from the drop down list box.

  9. Click the New button to create a new data source.
    In the 'Data source name' field type 'TptbmDS'.
    In the 'JNDI name' field type 'jdbc/TptbmDS'.
    Click Next.
    Click the 'Select an existing JDBC provider' check box and then select the name of the TimesTen JDBC provider.
    Click Next. Make sure that the 'Use this Data Source in container managed persistence' check box is checked. In the 'Data store helper class name' field '' should be specified.
    Click the Next button.
    Click the next button again on the 'Setup security aliases' step.
    Click the Finish button at the summary screen.

  10. Click on the 'TptbmDS' data source link.
    Click on the 'Custom properties' link.
    Click on the 'url' property link. In the 'Value' field type 'jdbc:timesten:direct:sampledb_1122'. Click the OK button.
    Click on the 'user' property link. In the 'Value' field type 'SCOTT'. Click the OK button.
    Click on the 'password' property link. In the 'Value' field type 'tiger'. Click the OK button.
    Click on the 'webSphereDefaultIsolationLevel' property link. In the 'Value' field type '2' for READ_COMMITTED. Click the Apply button.

  11. At the top of the page click on the link called 'Save' to save the server's configuration for this data source.
    At this point the jdbc/TptbmDS data source has been configured.

3. build the sample application

After the server has been configured to use the jdbc/TbtbmDS data source and restarted, the application can be built, through Ant script build-websphere8.xml, with this sequence of Ant tasks under directory quickstart/sample_code/j2ee_orm:

   ant -f build-websphere8.xml clean
   ant -f build-websphere8.xml package

These steps will result in a deployable archive file located in the dist directory called tptbmas-ejb3.jar.

Note: To avoid Java class version conflicts build the TptbmAS packages using the same JVM used by the application server. This can be done by setting the JAVA_HOME environment variable to the location of the JDK used by the application server in the shell where the application ant scripts are executed.

4. deploy the sample application

To deploy the archive to the server login to the WebSphere Administrative Console and follow these steps:

  1. Select Applications->New Application from the left hand panel.

  2. Click on the 'New Enterprise Application' link.

  3. Click the 'Local file system' option and then click the Choose File button. Navigate to the dist directory where the tptbmas-ejb3.jar file was created in step 3 above. Select the JAR file and click Open. Click Next.

  4. At the 'Preparing for the application installation' step select the 'Fast Path' option. Click on the 'Choose to generate default bindings...' label and then check the 'Generate Default Bindings' option. Click Next.

  5. At the 'Select installation options' step click Next.

  6. At the 'Map modules to servers' step click Next.

  7. At the 'Metadata for modules' step click Next.

  8. In the 'Summary' step click the Finish button to install the Tptbm EJB. When the installation process completes click the 'Save' link at the bottom of the page to save the configuration.

  9. Select Applications->Application Types->WebSphere enterprise applications from the left hand panel.

  10. Click on the check box next to the 'tptbmas-ejb3_jar' application. Click the Start button.

5. run the sample application

To run the client execute this command:

   ant -f build-websphere8.xml run

Note that this application has been tested with WebSphere Application Server 8.5.



Various problems may occur when using TimesTen with WebSphere. The list below describes possible solutions for common problems.


For more information on Java programming with Oracle TimesTen, refer to the Oracle TimesTen In-Memory Database Java Developer's Guide.