IMPORTANT PRE-REQUISITES
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/ttquickstartenv.sh OR
$ source quickstart/ttquickstartenv.csh2. 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.sql3. 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.
CONFIGURE AND RUN
1. install JBoss application server and configure build.properties
Install JBoss EAP 6 and then set the following properties in file quickstart/sample_code/j2ee_orm/build.properties:
jboss.home.dir -- set this to the root installation directory of the local JBoss EAP installation jboss.server.dir -- the location of the JBoss EAP directory for the server hosting the Tptbm entity bean jboss.deploy.dir -- the directory where application archives can be copied and auto deployed to the JBoss EAP jboss.host -- the host name of the machine where the server is installed jboss.port -- the RMI port number used by external clients to communicate with the server, the default port number is 4447Each Ant build script reads values from file quickstart/sample_code/j2ee_orm/build.properties. 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. Configure for JBoss RMI clients
JBoss RMI clients require that a configuration file called jboss-ejb-client.properties exist in the client's CLASSPATH. The demo includes this configuration file in the config/jbosseap6 directory. If the demo is executed on a different machine than the JBoss server then this file will need to be manually edited to reflect the properties of the remote JBoss server.
3. LD_LIBRARY_PATH
The JBoss server environment will need access to the TimesTen shared libraries. This can be done by setting the LD_LIBRARY_PATH environment variable (or the equivalent variable for your OS) to the location of the TimesTen installation's lib directory. On Windows platforms the PATH environment variable should be set to the location of the installation's bin directory where TimesTen DLLs are located. After changing these environment variables the JBoss server should be restarted.
4. TimesTen JDBC Driver
The server will require access to the TimesTen JDBC driver jar file. In JBoss EAP 6 this can be done by deploying the TimesTen JDBC driver jar file on the application server via the JBoss management console using this sequence of steps:
a. Connect to the JBoss management console. The default web address is http://localhost:9990/console. b. Select the Runtime tab near the top of the page. c. Expand the Server node on the left hand menu and select Manage Deployments. d. On the Deployments page click the Add button and then click Choose File in the resulting dialog box. e. Navigate to the location of the TimesTen JDBC drive jar file. If JBoss server is using JDK 1.7 then the ttjdbc7.jar version of the driver jar file located in the TimesTen installation's lib subdirectory should be selected. If JBoss server is using JDK 1.6 then select the ttjdbc6.jar file. f. Click the Next button in the Create Deployment dialog. g. Click the Save button in the Create Deployment dialog. h. On the Deployments page a new deployment called ttjdbc7.jar or ttjdbc6.jar should appear. Click the En/Disable button and then click Confirm to enable the TimesTen driver.4. TimesTen Data Source
Before the application can be deployed or executed, a TimesTen data source with the JNDI name of java:TbtbmDirectDS must be configured on the server. This can be done by configuring the data source on the application server via the JBoss management console using this sequence of steps:
a. Connect to the JBoss management console. The default web address is http://localhost:9990/console. b. Select the Profile tab at the top of the page. c. Expand the Subsytems and Connector nodes on the left hand menu and then select Datasources. d. Click the Add button. e. In the Datasource Attributes dialog box enter a name and a JNDI name for the new data source. The name should be set to 'TptbmDirectDS' and the JNDI name should be set to 'java:/TptbmDirectDS'. f. Click the Next button. g. In the JDBC Driver dialog select the TimesTen JDBC driver deployment called ttjdbc7.jar or ttjdbc6.jar. h. Click Next. i. In the Connection Settings dialog box, enter the TimesTen JDBC URL and TimesTen database user credentials for the connection. The URL should be set to 'jdbc:timesten:direct:SampleDb_1122'. The user should be set to 'scott' and the password 'tiger'. j. Click Done. k. At the JDBC Datasources screen click the Enable button and then click Confirm to enable the data source. l. To verify that the data source can connect to TimesTen click the Connection link and then click the Test Connection button.6. build, deploy and run the sample application
After the server has been configured to use the java:TptbmDirectDS data source and restarted, the application can be built, deployed, and executed, through Ant script build-jboss6.xml, with this sequence of Ant tasks under directory quickstart/sample_code/j2ee_orm:
ant -f build-jboss6.xml clean ant -f build-jboss6.xml package ant -f build-jboss6.xml deploy ant -f build-jboss6.xml run
Note that this application has been tested with JBoss EAP 6.2.0.GA.
TROUBLESHOOTING
- Make sure the TimesTen binary bit version (32-bit or 64-bit) is the same as the bit version of the Java binary used to start JBoss Server. Otherwise you may get a similar error as the following:
"Problems with loading native library/missing methods: D:\TimesTen\tt1122_32\bin\ttJdbc1122.dll : Can't load IA 32-bit .dll on AMD 64-bit platform"
- If the following error pops up in the step of "ant -f build-jboss6.xml run",
java.sql.SQLException: Problems with loading native library/missing methods: no ttJdbc1122 in java.library.path
it is because the JBoss server need access to the TimesTen shared libraries but env variables are not set correctly before launching the JBoss server. Make sure the LD_LIBRARY_PATH includes the location of the TimesTen installation's lib directory. Or, on Windows platforms the PATH environment variable should include the location of the TimesTen installation's bin directory where TimesTen DDLs are located. (See step No.3 above).
For more information on Java programming with Oracle TimesTen, refer to the Oracle TimesTen In-Memory Database Java Developer's Guide.