JDBC is an industry standard Java API for SQL query and data management. This page provides a set of sample programs using JDBC to access the Oracle TimesTen in-memory database. See the Oracle TimesTen In-Memory Database Installation Guide for supported JDK versions.
Program | Description |
asyncJMS.java | This program uses the TimesTen JMS/XLA implementation to process messages: |
level1.java | This program uses the TimesTen JDBC DriverManager interface to show basic operations on a TimesTen database: a) Connect using the com.timesten.jdbc.timesTenDriver interface b) Insert into the CUSTOMER table all the data read from input file input1.dat file c) Call ttOptUpdateStats to update statistics d) SELECT from the CUSTOMER table, fetch, and print the result set to stdout e) Disconnect from the database |
level2.java | This program uses the TimesTen DataSource interface to show basic operations on a TimesTen database: a) Connect using the TimesTenDataSource interface b) Insert all the data read from the input2.dat file located in the datfiles subdirectory c) Call ttOptUpdateStats to update statistics d) DELETE duplicate product data from the PRODUCT table e) Update the PRODUCT table by increasing the product price by 10% f) SELECT the data from the PRODUCT table, fetch and print the result set to stdout; and g) Disconnect from the database |
level3.java | This program uses the TimesTen JDBC driver to perform order processing operations: a) Connect to the database using the TimesTenDataSource interface b) Process all orders in the input3.dat file by inserting into the ORDERS and ORDER_ITEM tables, select from the Inventory table to check available quantity, and update the INVENTORY table to debit the quantity from the order. If there is not enough quantity in the inventory, the program rolls back the transaction and issues the message. c) Disconnect from the database. |
level4.java | This program is the multi-threaded version of the level3.java program. This program uses multiple threads to increase the application throughput. |
plsqlJDBC.java | This sample program uses JDBC to access common PL/SQL packages (emp_pkg and sample_pkg) in four different ways: The EMP table and the emp_pkg and sample_pkg PL/SQL packages need to exist for this program to work.
|
syncJMS.java | This program uses the TimesTen JMS/XLA implementation to process messages: |
Tptbm.java | This program implements a multi-user throughput benchmark. By default, the transaction mix consists of 80% SELECT (read) transactions and 20% UPDATE (write) transactions. In addition to SELECTs and UPDATEs, INSERTs can also be included in the transaction mix. The ratio of SELECTs, UPDATEs and INSERTs is specified at the command line. Each transaction consists of one or more SQL operations.
The benchmark initially populates the data store, and then executes the transaction mix on it. The number of tuples inserted as part of the transaction mix cannot exceed the number of tuples with which the database is populated initially. The measurement error for the benchmark is at most 2 seconds. This will be negligible at loads with a duration in excess of 200 seconds. A suggested load for the benchmark is one that lasts at least 600 seconds.The schema for this test is described in the program source file tptbm.java. |
TTJdbcExamples.java | This program demonstrates the following operations using the TimesTen JDBC DriverManager interface to: a) Connect and disconnect b) Perform some DDL and DML operations: create table, create index, prepare statements, insert into and select from a table c) Make changes to influence the query plan d) Execute batch updates |
JDBC Connection Pool | A sample JDBC connection pool implementation is available at the quickstart/sample_code/jdbc/connection_pool directory. |
The above JDBC sample programs are available in the quickstart/sample_code/jdbc directory.
Compile and Run: learn how to compile and run the sample programs on your installed platform.
For more information on Java programming with Oracle TimesTen, refer to the Oracle TimesTen In-Memory Database Java Developer's Guide.
Home | Site Map | Contact Us | Copyright © 2011 |