DB2 Version 9.7 for Linux, UNIX, and Windows

New DB2 sample programs have been added

You can use DB2 sample programs as templates to create your own application programs and to learn about DB2 product functionality.

The samples are bundled with all of the server editions of the DB2® for Linux, UNIX, and Windows and with the IBM® Data Server Client. You can find the samples in the following locations:

The new sample programs are as follows.

Table 1. New Version 9.7 sample programs
Category Feature or enhancement Sample description
Application development Currently committed semantics for improved concurrency The AIRLINE.war sample program shows how to use currently committed semantics with the cursor stability isolation level to avoid lock waits and deadlock scenarios. This sample program is located at: %DB2PATH%\sqllib\samples\java\Websphere
Improved scalar functions The scalarfunction.db2 and ScalarFunctions.java sample programs show how to use built-in support for functionality that would otherwise be developed by using user-defined functions (UDFs).
Implicit casting The implicitcasting.db2 and ImplicitCasting.java sample programs show how to use implicit casting with data type assignments, comparisons, and NULL values.
Created temporary tables The cgtt.db2 and Cgtt.java sample programs show how to store the intermediate results and how to use created temporary tables with procedures, functions, triggers, and views.
Autonomous transactions The autonomous_transaction.db2 sample program shows how to track events when a procedure created by using the AUTONOMOUS keyword of the CREATE PROCEDURE statement attempts to access restricted data.
Default parameters The defaultparam.db2 sample program shows how to use the keyword DEFAULT as a parameter in CREATE PROCEDURE and CALL statements.
Public aliases The public_alias.db2 sample program shows how to use public aliases for database objects such as tables and modules.
Date compatibility features The datecompat.db2 sample program shows DATE formats, DATE addition and subtraction, scalar functions, and interpretation of DATE data type as TIMESTAMP (0) data type in date compatibility mode.
Modules The modules.db2 sample program shows how to create modules, public and private module objects such as procedures and functions; user-defined row data types; associative arrays; parameterized cursors, and strongly-typed and weakly-typed cursors. The program also shows how to pass the data types and cursors as parameters to the procedures and functions and how to use the data types and cursors within the procedures and functions. The program also shows how SQL PL supports triggers, UDFs and stand-alone compiled compound statements.
XML Partitioned tables The xrpart.db2 sample program shows how to use XML in partitioned tables and how these tables support global indexes.
Partitioned environments The xmlpartition.db2 sample program shows how to use XML in partitioned databases, MDC, and partitioned tables.
XML support for MDC tables The xmlmdc.db2 and XmlMdc.java sample programs show how to move data from non-MDC tables to MDC tables. The program also highlights the use of block indexes, XML indexes, and faster insertion and deletion.
Improved XML data type support The XmlUdfs.java, xmludfs.db2, xmludfs.sqc, and xmludfs.c sample programs show how to use the XML data type. The programs show how to pass the XML data type as an input parameter, declare XML data type local variables, and return values when using scalar functions, sourced functions, SQL-bodied UDFs and table UDFs.
Inline LOB functions The xmldbafn.db2 sample program shows how to use the ADMIN_IS_INLINED function to determine whether all XML documents are inlined. The program also shows how to use the ADMIN_EST_INLINE_LENGTH function to get the estimated inline length for XML documents that are not inlined.
Annotated XML schema decomposition The xmldecomposition.db2, XmlDecomposition.java, and xmldecomposition.sqc sample programs show how to decompose instance documents and use annotated XML decomposition to store the data in relational tables.
Index reorganization The xmlolic.db2 sample program shows how to use the REORG command with the ALLOW WRITE ACCESS parameter to reorganize indexes defined on a table and how to reorganize nonpartitioned indexes on a partitioned table.
Declared global temporary tables with XML The xmlindgtt.db2 sample program shows how to use declared global temporary tables with the XML data type and how to create indexes on XML documents.
Monitoring Java-based tool for event monitor reports The db2evmonfmt.java sample program shows how to produce readable flat-text output or formatted XML output from the data generated by an event monitor that uses an unformatted event table.
Workload management DB2 workload manager (WLM) tiered service class configuration setup The wlmtiersdefault.db2 sample program shows how to set up a DB2 WLM tiered service class configuration for a database. The database throughput in response to the elapsed execution time of incoming activities can be improved using this tiered service. This sample program also demonstrates the use of service classes, workloads, and thresholds.
DB2 WLM tiered service class configuration setup The wlmtierstimerons.db2 script shows how to set up a DB2 WLM manager tiered service class configuration for a database. Unlike the wlmtiersdefault.db2 script, the wlmtierstimerons.db2 script takes the estimated cost into account when initially mapping DML activities to service classes.
Dropping of DB2 WLM service classes, thresholds, workloads, work classes, and work action sets The wlmtiersdrop.db2 script shows how to drop all service classes, thresholds, workloads, work classes, and work action sets that were created by the wlmtiersdefault.db2 and wlmtierstimerons.db2 scripts.
Generates a script that will help migrate a Query Patroller environment to a WLM environment The qpwlmmig.pl script reads the DB2 Query Patroller tables and, based on information from those tables, generates a script that contains the DDL required to create a comparable WLM setup. It also generates a second script file (<filename>.DROP) containing the DDL to undo the changes from the first script. The qpwlmmig.pl script is available starting in Version 9.7 Fix Pack 1 and later fix packs.