Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

developerWorks Community:

  • Close [x]

DB2 9 Application Development exam 733 prep, Part 4: Embedded SQL programming

Build applications that interact with DB2

Roger E. Sanders (rsanders@netapp.com), Senior Manager - IBM Alliance Engineering, Network Appliance, Inc.
Author1 photo
Roger E. Sanders is a Senior Manager - IBM Alliance Engineering at Network Appliance, Inc. He has been designing and developing databases and database applications for more than 20 years and has been working with DB2 Universal Database since it was first introduced with OS/2 1.3 Extended Edition. He has written articles for IDUG Solutions Journal, Certification Magazine, and developerWorks, presented and taught classes at IDUG and RUG conferences, participated in the development of the DB2 certification exams, writes a regular column for DB2 Magazine and is the author of 9 books on DB2 UDB.
(An IBM developerWorks Master Author, Level 2)

Summary:  This tutorial introduces you to embedded SQL programming and walks you through how to construct an embedded SQL application. This tutorial introduces the process for converting one or more high-level programming language source code files containing embedded SQL into an executable application. This is the fourth in a series of nine tutorials designed to help you prepare for the DB2 Application Developer Certification exam (Exam 733).

View more content in this series

Date:  15 Feb 2007
Level:  Introductory PDF:  A4 and Letter (521 KB | 33 pages)Get Adobe® Reader®

Comments:  

Before you start

About this tutorial

This tutorial introduces you to embedded SQL programming and walks you through the basic steps of constructing an embedded SQL application. This tutorial also provides you an introduction to converting one or more high-level programming language source code files containing embedded SQL into an executable application. In this tutorial, you will learn:

  • How SQL statements are embedded in a high-level programming language source code file
  • The steps involved in developing an embedded SQL application
  • What host variables are, how they are created, and how they are used
  • What indicator variables are, how they are created, and when they are used
  • How to analyze the contents of an SQLCA data structure variable
  • How to establish a database connection from an embedded SQL application
  • How to capture and process errors when they occur
  • How to convert source code files containing embedded SQL into an executable application

This is the fourth in a series of nine tutorials designed to help you prepare for the DB2 Application Developer Certification exam (Exam 733). The material in this tutorial covers the objectives in Section 4 of the exam, entitled "Embedded SQL programming." You can view these objectives at http://www.ibm.com/certify/tests/obj733.shtml.

You do not need a copy of DB2 Universal Database to complete this tutorial. However, you can download a free trial version of IBM DB2 Universal Database Enterprise Edition, and a free copy of DB2 Express-C 9 from the DB2 Express-C downloads page.


Objectives

After completing this tutorial, you should be able to:

  • Establish a database connection within an embedded SQL application
  • Execute SQL statements within an embedded SQL application
  • Analyze results and handle common errors encountered when SQL statements are executed in an embedded SQL application

Prerequisites

To understand some of the material presented in this tutorial, you should be familiar with the following terms:

  • Object: Anything in a database that can be created or manipulated with SQL (for example tables, views, indexes, and packages).

  • Table: A logical structure used to present data as a collection of unordered rows with a fixed number of columns. Each column contains a set of values, each value of the same data type (or a subtype of the column's data type); the definitions of the columns make up the table structure, and the rows contain the actual table data.

  • DB2 optimizer: A component of the SQL precompiler that chooses an access plan for a Data Manipulation Language (DML) SQL statement by modeling the execution cost of several alternative access plans and choosing the one with the lowest estimated cost.

1 of 8 | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management
ArticleID=195578
TutorialTitle=DB2 9 Application Development exam 733 prep, Part 4: Embedded SQL programming
publish-date=02152007
author1-email=rsanders@netapp.com
author1-email-cc=