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 successfully 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 Enterprise. These structures contain error, warning and information message codes that Adaptive Server Enterprise and Client-Library generate. See Chapter 3, “Communicating with Adaptive Server Enterprise.”

  2. Declare Variables.

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

  3. Connect to Adaptive Server Enterprise.

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

  4. Send Transact-SQL statements to Adaptive Server Enterprise.

    Send Transact-SQL statements to Adaptive Server Enterprise 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 Enterprise using SQLCA, SQLCODE, or SQLSTATE. See Chapter 8, “Handling Errors.”