1 Java Development Environment

This chapter provides information about the Java development environment and related considerations. It includes the following topics:

Installing TimesTen and the JDK

Install and configure TimesTen for your environment, as described in Oracle TimesTen In-Memory Database Installation, Migration, and Upgrade Guide for TimesTen Classic or "Prerequisites and Installation of TimesTen Scaleout" in Oracle TimesTen In-Memory Database Scaleout User's Guide for TimesTen Scaleout.

Install the Java JDK as described in your Java installation documentation.

Note:

The TimesTen JDBC driver implements the JDBC 4.2 API (Java 8) and is certified to work with Java 8, 9, and 10 runtime environments (JRE).

For TimesTen Scaleout, DSNs are automatically available for all connectables defined in the grid. Refer to "Connecting to a database" in Oracle TimesTen In-Memory Database Scaleout User's Guide.

For TimesTen Classic, after you have installed and configured TimesTen, create a database DSN (data source name) as described in "Managing TimesTen Databases" in Oracle TimesTen In-Memory Database Operations Guide. (A DSN is a logical name that identifies a TimesTen database and the set of connection attributes user for connecting to the database.) Topics of particular interest include the following:

Setting the environment for Java development

Before you begin developing Java applications for TimesTen, you must set your environment appropriately. This includes setting environment variables.

Environment variables and runtime access to the Instant Client are configured through the appropriate ttenv script in the timesten_home/bin directory, where timesten_home is the TimesTen instance home directory: ttenv.sh and ttenv.csh for Linux and UNIX platforms (where which you use depends on your shell) and ttenv.bat for Windows platforms.

See "Environment variables" and "Java environment variables" in Oracle TimesTen In-Memory Database Installation, Migration, and Upgrade Guide for information about environment variables, including how to set them using ttenv and discussion of the PATH and CLASSPATH environment variables.

Note:

TimesTen includes Oracle Instant Client, which is required for certain JDBC features and operations.

Compiling Java applications

"Java environment variables" in Oracle TimesTen In-Memory Database Installation, Migration, and Upgrade Guide discusses the CLASSPATH setting for compiling Java applications in TimesTen.

Compiling any Java application requires the JAR file appropriate for your JDK to be in your classpath. In TimesTen, the following is for JDK 8:

timesten_home/install/lib/ttjdbc8.jar

In addition, compiling any JMS/XLA application requires the following to be in your classpath:

timesten_home/install/lib/timestenjmsxla.jar
timesten_home/install/3rdparty/jms1.1/lib/jms.jar
timesten_home/install/lib/orai18n.jar

Use the appropriate ttenv script to set your environment, as discussed in the preceding section.

Notes:

  • For each TimesTen instance, the timesten_home/install path is a symbolic link to installation_dir, where TimesTen is installed.

  • On Windows, there is only one TimesTen instance per installation, and timesten_home refers to installation_dir\instance.

TimesTen Quick Start and sample applications

The TimesTen Classic Quick Start and TimesTen Scaleout sample applications are available from the TimesTen GitHub location. For the TimesTen Classic Quick Start, there is a complete set of tutorials, how-to instructions, and sample applications. For TimesTen Scaleout, there are ODBC and JDBC sample applications.

After you have configured your environment, you can confirm that everything is set up correctly by compiling and running the sample applications. For TimesTen Classic, applications are located under the Quick Start sample_code directory. For instructions on compiling and running them, see the instructions in the subdirectories. For TimesTen Scaleout, clone the oracle-timesten-examples GitHub repository and follow the instructions in the README files.

For TimesTen Classic, the following are included:

  • Schema and setup: The build_sampledb script (.sh on Linux or UNIX or .bat on Windows) creates a sample database and schema. Run this script before using the sample applications.

  • Environment and setup: The ttquickstartenv script (.sh or .csh on Linux or UNIX or .bat on Windows), a superset of the ttenv script typically used for TimesTen setup, sets up the environment. Run this script each time you enter a session where you want to compile or run any of the sample applications.

  • Sample applications and setup: The Quick Start provides sample applications and their source code for JDBC.