Microsoft & .NET .NET DB2 Universal Database and the .NET Developer - Information and Other Goodies

DB2 Universal Database and the .NET Developer – Information and Other Goodies

In Part 1
of this series, I covered the IBM Explorer and its unique features that help .NET
application developers write applications for the IBM DB2
Universal Database (DB2 UDB) product family. In Part 2,
I introduced you to a set of schema creation wizards that let you
point-and-click your way to database objects with extra features that make this
process easier than ever.

The DB2 UDB add-in for Microsoft Visual Studio .NET also comes with a set of information, troubleshooting, and accessibility features
that allow developers to quickly diagnose and solve database-specific issues, and
get the information they need at their fingertips. In this article, I will
cover a mixed bag of features that make .NET developers more productive when
programming to a DB2 UDB database.

Access to Help

The DB2 UDB add-in for Visual Studio.NET comes with searchable,
native, and context-sensitive help. To be blunt, we are not going to ask
developers that use Visual Studio.NET to launch a DB2 UDB server tool to get
quick access to the information that they need. In fact, if you cannot find the
information you are looking for right in the IDE, we know the next place you
are going to look (the Internet) and we have taken care of that as well. (More on
that in a bit.)

The following figure shows the native help integration that
is added to Visual Studio.NET when you install the DB2 UDB add-in:

Microsoft developers have a passion for the productivity
they get out of the Visual Studio .NET IDE – and with good reason – it is a
great tool. As I said before, IBM understands that Microsoft developers want to
remain in their IDE to accomplish their work.

When developers leave their IDE, if they are not going for a
cup of coffee, chances are they are going to some sort of instant messaging
software such as MSN Messenger, or to a Web browser like Internet Explorer. To
accommodate these habits, IBM hooked up all the DB2 UDB help such that when you
perform a Google search on DB2 UDB information – chances are more than likely
that the online documentation will come up first in your search list, as in the
following example:

What’s more, since this help is hosted online, you can use
your browser’s language settings to transparently switch between languages:

DB2 UDB for .NET Knowledge Domains

There are a number of knowledge domains available that are chock
full of articles, tutorials, scripts, and more.

For example, IBM has its own developerWorks Web
site with topic-specific domains for all kinds of programming paradigms,
technologies, and more. The Visual Studio .NET zone (shown below) is available
at: www-128.ibm.com/developerworks/db2/zones/vstudio/.

And while you might expect IBM to host such a site, it is interesting
to note that other development resource domains have been springing up with zones
devoted to DB2 UDB and .NET – a testament to the growing number of developers
using this technology with DB2 UDB. For example, the popular DevX Web site
(shown below) has a showcase for DB2 UDB and .NET available at: www.devx.com/IBMDB2/Door/21980?trk=Stinger%5FFeatPart.

DB2 UDB Instance Control

DB2 UDB for Windows comes with a system tray
tool (shown below) that allows you to stop and start your DB2 UDB instances
from a desktop GUI tool. (It is somewhat similar to the SQL Server Service Manager.)
You can invoke this tool using the db2systray.exe command; it will
default to start each time you start the Windows operating system.

This instance control tool can also be used to pre-launch
the DB2 Control Center for faster startup of the management interface for DB2 UDB
– but this is more likely to be used by a database administrator (DBA) than a
developer. This tool is shown below (it is the green icon in the taskbar, and
yes, I know I am running out of battery power):

DB2 Updates

When it comes to development environments, drivers, and APIs
– being up-to-date is critical to optimal performance. To ensure that you have
access to a rich continuum of tools, I recommend that .NET developers have
their clients and databases at the DB2 UDB Version 8.2.2 level, which lets you
use concurrent data readers to access more than one result set in the same
database connection and query both of those result sets concurrently. You need
to host a DB2 UDB environment at the V8.2 level or later to take advantage of many
of the features I have outlined in this series.

So what is an easy way to keep your development systems up-to-date?
The DB2 UDB add-in for Visual Studio .NET includes an option from the Help menu
that lets you check the Web for DB2 UDB updates, as shown below:

This option launches an updater service that not only informs
you of updates available for download, but also acts as a news feeder for DB2
UDB-related information.

Debugging Your Routines

The DB2 UDB add-in for Visual Studio includes integrated
debugging of stored procedures. While IBM has its own distributed debugger, the
Visual Studio .NET debugger has been extended to support the backend DB2 SQL
debugger. This allows you to use the Visual Studio.NET debugger to step through
your code, set line or variable breakpoints, view variable values (including
SQLSTATE and SQLCODE), change variable values, view call stack information for
nested procedures, and switch between different procedures on the call stack. This
affords developers a powerful debugging environment that they are accustomed to
for their DB2 UDB business logic.

An example of this integrated debugger is shown below:

The DB2 UDB SQL Editor

The DB2 UDB add-in comes with a DB2 SQL editor that
understands the DB2 UDB SQL API. If you have read any other of the articles in
this series, you have seen this feature utilized in other features like the DB2
Create View wizard and the DB2 Create SQL Procedure wizard. The DB2 SQL editor is
composed of extensions to the native Visual Studio .NET editor with
customizations for DB2 UDB.

The DB2 SQL editor provides support for syntax highlighting,
which is basically colorized SQL. It also supports DB2 SQL statement completion
via .NET Intellisense; the object names lookup uses schemas followed by a dot, the
column names lookup uses tables or views followed by a dot, and the parameter
list lookup uses procedures or functions followed by an open bracket.

The DB2 SQL editor is shown below:

In addition to this, you can create code fragments that are
collapsible and expandable, as shown in the following figure:

There are a number of other scripting options, some of which
are shown in the preceding figure.

The DB2 UDB Output Message Pane

To help developers quickly diagnose build failures that are due
to database-specific issues, IBM has also included an output message pane
solely designed for DB2 UDB database message reporting:

Wrapping it all up

In this part of the series, I took you through a number of
features that help speed up application development. You have seen easier ways
to start instances, get DB2 UDB help, identify database errors, troubleshoot
your routines, debug, and more.

Are you ready to try it out for yourself? Get a free trial
copy of a DB2 UDB for Windows server at: www.ibm.com/software/data/db2/udb/support/downloadv8.html. You can also get a free
copy of DB2 UDB Personal Edition for development purposes at: www.software.ibm.com/webapp/download/search.jsp?go=y&rs=db2udbpde.

About the Author

Paul C.
Zikopoulos, BA, MBA
, is
an award-winning writer and speaker with the IBM Database Competitive Technologies team. He has more than nine years of
experience with DB2 products and has written numerous magazine articles and
books about it. Paul has co-authored the
books: DB2 Version 8: The Official
Guide
, DB2: The Complete Reference, DB2
Fundamentals Certification for Dummies
,
DB2 for Dummies, and A DBA’s
Guide to Databases on Linux
. Paul is a DB2 Certified Advanced
Technical Expert (DRDA and Cluster/EEE) and a DB2
Certified Solutions Expert (Business Intelligence and Database Administration).
Currently he is writing a book on the Apache Derby/IBM Derby database. You can
reach him at: [email protected].

Trademarks

IBM, DB2, DB2
Universal Database, and developerWorks are trademarks or registered trademarks
of International Business Machines Corporation in the United States, other countries, or both.

Java and all
Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.

Microsoft and
Windows are trademarks of Microsoft Corporation in the United States, other countries, or both.

Intel is a trademark
or registered trademark of Intel Corporation in the United States and other countries.

UNIX is a
registered trademark of The Open Group in the United States and other countries.

Linux is a
trademark of Linus Torvalds in the United States,
other countries, or both.

Other company,
product, and service names may be trademarks or service marks of others.

© Copyright
International Business Machines Corporation, 2005. All rights reserved.

Disclaimer

The opinions,
solutions, and advice in this article are from the author’s experiences and are
not intended to represent official communication from IBM or an endorsement of
any products listed within. Neither the author nor IBM is liable for any of the
contents in this article. The accuracy of the information in this article is
based on the author’s knowledge at the time of writing.

Latest Posts

Related Stories