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]

ADO.NET data adapters using DB2 UDB V8.2 procedures

Abdul Al-Azzawe (abdulh@us.ibm.com), DB2 Tools architect, IBM
Abdul Al-Azzawe is the DB2 Tools architect for Visual Studio .NET. He joined IBM in 1990 and worked in the Toronto lab for ten years as part of the DB2 engine development team with special focus on the Windows platform. In March of 2000, Abdul joined the IBM Silicon valley lab to architect the release of the DB2 integrated SQL debugger, the DB2 Development Center, and the DB2 Development Add-Ins for Visual Studio 6.0. In May of 2002, Abdul joined the IBM San Francisco team to architect the integration with Visual Studio .NET, one of his proudest achievements in his career at IBM. Abdul has written numerous technical articles under DB2 Developer Domain covering a variety of DB2 application development topics. Abdul appreciates hearing feedback from actual developers about DB2 tools, and welcomes any suggestions for ways to improve these products.

Summary:  Configuring ADO.NET data adapters to call DB2 UDB stored procedures was a complex task prior to the introduction of the DB2 Stinger technology! This tutorial walka you through the steps required to build an application that uses SQL stored procedures to select, insert, update, and delete rows from database tables and views. Any of the DB2 server products may be used with this tutorial, including DB2 for z/OS V6 or later, and DB2 for iSeries V5r1 or later.

Date:  17 Aug 2004
Level:  Introductory PDF:  A4 and Letter (271 KB | 26 pages)Get Adobe® Reader®

Activity:  6974 views
Comments:  

Getting started

Tutorial overview

Configuring Microsoft ADO.NET data adapters to call DB2 stored procedures was a complex task prior to the introduction of the DB2 Universal Database (UDB) V8.2 Stinger technology. This tutorial walks you through the steps required to build an application that uses SQL stored procedures to select, insert, update, and delete rows from database tables and views. You will learn about the new features of the DB2 Data Adapter Configuration wizard that will allow you to not only define and manage the shape of your result set, but also define commands that invoke any language stored procedures instead of executing direct SQL.

Among the many benefits of using stored procedures instead of direct SQL from our client application is the fact that we will both optimize the execution of our application through the use of static SQL and will hide the actual schema from the client application developers. By abstracting the database schema, we allow our database architects to optimize the schema without impacting client application code.

Note:

Any of the DB2 server products may be used with this tutorial including: DB2 for z/OS V6 or later, DB2 Distributed Server V8.1 or later, and DB2 UDB for iSeries v5r1 or later, hereafter referred to as "DB2."


Why should I take this tutorial?

You should take this tutorial if you want to learn about:

  • Creating new SQL stored procedures directly from the IBM Explorer.
  • Configuring DB2 data adapters to use stored procedures for select, insert, update, and delete operations.
  • Defining and altering the result set shape for a data adapter.
  • Binding form controls to input parameters of stored procedure commands.
  • Generating a data set for a stored procedure based data adapter.
  • Binding form controls to a DB2-generated data set.

Software requirements

The tutorial was built using software from both IBM and Microsoft:

  • IBM DB2 V8.2 Client or DB2 Connect, V8.2
  • IBM DB2 V8.2 Application Development Client
  • Any one of the following IBM DB2 servers:
    • DB2 for z/OS Server V6 or later
    • DB2 for iSeries V5r1 or later
    • DB2 Distributed Server V8 or later
  • Microsoft Windows 2000, 2003, or XP with the Microsoft .NET framework V1.1
  • Microsoft Visual Studio 2002 or 2003

Creating the database

In the course of this tutorial, we will be creating a sample table and four stored procedures using a local or remote DB2 UDB database. If you already have a database that you can use, then you can skip this step.

To create a test database, do the following:

  • Launch the Visual Studio IDE.
  • Execute the View > IBM Explorer menu action to display the IBM Explorer view.
  • Right click on the Data Connections folder and execute the Create New DB2 Database pop-up menu action. This will launch the Create DB2 Database dialog.
  • Create DB2 Database
  • Type the desired name of the local database and click OK.

Note:

You can use the DB2 Control Center to create a remote DB2 UDB database.


Adding the data connection

Now that we have created a new database or identified an existing database to use for this tutorial, we need to add the corresponding data connection to the IBM Explorer.

To add the data connection, do the following:

  • Launch the Visual Studio IDE.
  • Execute the View > IBM Explorer menu action to display the IBM Explorer view.
  • Right click on the Data Connections folder and execute the Add Connection pop-up menu action. This will display the Add DB2 Data Connection dialog.
    Add DB2 Data Connection
  • In the Connection tab, discover or specify the appropriate information required to identify your DB2 UDB connection.
  • In the Filter tab, specify initial schema filters for your data connection. This is an important step as it will avoid the retrieval of unwanted catalog information.
  • Click OK.

The desired data connection should now be added to your Data Connections folder in the IBM Explorer with all subfolder catalog information being retrieved and displayed asynchronously.

Note:

If you are targeting a DB2 for z/OS data connection, you must specify the z/OS SQL build options for this data connection. This can be accomplished by executing the z/OS SQL Procedure Options pop-up menu action on the z/OS data connection after it is added.

1 of 8 | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management
ArticleID=140137
TutorialTitle=ADO.NET data adapters using DB2 UDB V8.2 procedures
publish-date=08172004
author1-email=abdulh@us.ibm.com
author1-email-cc=