TTClasses provides a set of C++ classes and APIs for database developers to implement C++ applications to run on the Oracle TimesTen database. This page provides a listing of the sample programs using TTClasses. The goal is to help jump start developers who are new to TimesTen by providing a set of sample programs that demonstrate the core features of the TimesTen in-memory database.
The following TTClasses sample programs are available in the quickstart/sample_code/ttclasses directory.
|basics.cpp||This sample program is a good starting template for projects that use TTClasses. It shows how to connect to and disconnect from a TimesTen database and how to prepare, bind, execute, fetch and close SQL statements. Examples of TTClasses exception handling and timing SQL operations for both serializable and committed read transactions are shown.|
|bulkcp.cpp||This sample program uses dynamic SQL to run a SQL query and writes the output to the console or a file. The user enters the SQL query on the command line. The user can optionally specify the characters to display for NULL values and column separators.|
|bulktest.cpp||This sample code executes a series of insert, update and delete operations first in 'non-bulk' and then in 'bulk' mode with variable batch sizes. When the "batchsize" is set to 256 (the optimal value), significant performance benefits can be achieved for insert operations and modest improvements for update and delete operations.|
|catalog.cpp||This sample program prints out the database schema information including all tables, views, and indexes. .|
|plsqlTTCLASSES.cpp||This sample program uses TTClasses to access common PL/SQL packages (emp_pkg and sample_pkg) in four different ways:
- Calls a stored procedure with IN and OUT parameters
|pooltest.cpp||This sample program demonstrates multi-threaded connection pool usage and error handling. This program shows how to use the TTConnectionPool class in TTClasses in a multi-threaded application. The user can specify the number of threads to use for the insert operations and the number of connections to keep in the connection pool.|
|ttSizeAll.cpp||This sample program demonstrates calling TimesTen utility ttSize for multiple tables.|
|typetest.cpp||This sample program demonstrates the use of different datatypes supported by Oracle TimesTen by creating a table, typetest, which contains columns of all supported datatypes. The program then inserts data into the table and queries the data from the table.|
|ttXlaAdmin.cpp||This particular TTClasses sample program is available in the quickstart/sample_code/ttclasses/xla directory.
This program shows how to list or remove XLA bookmarks in the database. This program requires a user with ADMIN privilege to run because only the administrator is allowed to see all bookmarks in the system. A user with the XLA privilege is allowed to list or remove his/her own bookmark.
Unwanted bookmarks that are preventing transaction log files from being purged can create operational issues on the system and should be removed.
The "list" option is the default option for running the program without any input. For each XLA bookmark found in the system, the program lists the bookmark name, its LSN and whether the bookmark is holding transaction logs.
The "remove" option allows the user to delete the XLA bookmark via its bookmark name. The "removeall" option allows all of the bookmarks to be deleted. Bookmarks can only be deleted when not in use.
|xlasubscriber1.cpp||This particular TTClasses sample program is available in the quickstart/sample_code/ttclasses/xla directory.
This program shows how to use the Transaction Log API (XLA) facility to subscribe to change notifications for a table, chosen by the user at run time.
This program shows how to create persistent XLA bookmark and monitor and process changes on the specified table. The program displays the change records processed and the operations that were performed on the table (insert, update, or delete) to cause the change.
To create workload on the table being tracked, use a ttIsql session or a TimesTen user application to inject changes to the the table being tracked. This program requires a user with XLA privilege to run.
|xlasubscriber2.cpp||This particular TTClasses sample program is available in the quickstart/sample_code/ttclasses/xla directory.
This program shows how to subscribe to XLA events on multiple tables of interest (in this case three). This program monitors changes to three tables: MYTABLE, ICF and ABC.
The column names and their values are shown for every row affected by the transaction's inserts, updates and deletes. To create the transactional workload, a ttIsql session or a TimesTen user application can perform the transactions to the MYTABLE, ICF and/or ABC tables.
This program is an example of an XLA subscriber which only has the permission to see the changes to the table of interest, but not to access the table of interest itself. The program requires a user with XLA privilege to run.
Compile and Run
Click here to learn how to compile and run the sample programs on your installed platform.
For more information on TTClasses, refer to the Oracle TimesTen In-Memory Database TTClasses Guide.