Five tasks of an Embedded SQL program

In addition to containing the host language code, an Embedded SQL program performs five tasks. Each Embedded SQL program must perform all these tasks to precompile, compile, and execute. Subsequent chapters discuss these five tasks.

  1. Establish SQL communication using SQLCA, SQLCODE, or SQLSTATE.

    Set up the SQL communication area (SQLCA, SQLCODE, or SQLSTATE) to provide a communication path between the application program and Adaptive Server. These structures contain error, warning, and information message codes that Adaptive Server and Client-Library generate. See Chapter 3, “Communicating with Adaptive Server.”

  2. Declare variables.

    Identify host variables used in Embedded SQL statements to the precompiler. See Chapter 4, “Using Variables.”

  3. Connect to Adaptive Server.

    Connect the application to Adaptive Server. See Chapter 5, “Connecting to Adaptive Server.”

  4. Send Transact-SQL statements to Adaptive Server.

    Send Transact-SQL statements to Adaptive Server to define and manipulate data. See Chapter 6, “Using Transact-SQL Statements.”

  5. Handle errors and return codes.

    Handle and report errors returned by Client-Library and Adaptive Server using SQLCA, SQLCODE, or SQLSTATE. See Chapter 8, “Handling Errors.”