IBM Books

Call Level Interface Guide and Reference


Chapter 2. Writing a DB2 CLI Application

  • Initialization and Termination
  • Handles
  • Connecting to One or More Data Sources
  • Initialization and Connection Example
  • Transaction Processing
  • Diagnostics
  • Data Types and Data Conversion
  • Working with String Arguments
  • Querying Environment and Data Source Information
  • This section introduces a conceptual view of a typical DB2 CLI application.

    A DB2 CLI application can be broken down into a set of tasks. Some of these tasks are organized into discrete steps, while others may apply throughout the application. Each task is carried out by calling one or more DB2 CLI functions.

    Tasks described in this section are basic tasks that apply to all applications. More advanced tasks, such as using array insert or using large object support, are discussed in Chapter 3, Using Advanced Features.

    The functions are used in examples to illustrate their use in DB2 CLI applications. Refer to Chapter 5, DB2 CLI Functions for complete descriptions and usage information for each of the functions.

    Figure 1. Conceptual View of a DB2 CLI Application


    Conceptual View of a DB2 CLI Application


    Every DB2 CLI application contains the three main tasks shown in Figure 1.

    Initialization
    This task allocates and initializes some resources in preparation for the main Transaction Processing task. Refer to Initialization and Termination for details.

    Transaction Processing
    This is the main task of the application. SQL statements are passed to DB2 CLI to query and modify the data. Refer to Transaction Processing for details.

    Termination
    This task frees allocated resources. The resources generally consist of data areas identified by unique handles. Refer to Initialization and Termination for details.

    As well as the three tasks listed above, there are general tasks, such as handling diagnostic messages, which occur throughout an application.


    [ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

    [ DB2 List of Books | Search the DB2 Books ]