Featured Database Articles
Posted Jun 11, 2008
DB2 and Visual Studio 2008: Getting Started - Page 2
By Paul Zikopoulos
If the check box for a given table
type is selected, tables of that type are shown under a data connection for the
appropriate data server. The options in the Select Table Type Filter are
DB2 for Linux, UNIX, and Windows (LUW)
T - Table (untyped)
H - Hierarchy table
U - Typed table
S - Materialized Query Table (MQT)
N - Nickname
DB2 for i
S - Physical
DB2 for z/OS (zOS)
G - Created global temporary table
X - Auxiliary table
N - Nickname
dont use these options since I often connect to DB2 for Linux, UNIX, and
Windows and DB2 for z/OS data servers. However, many developers who are
connecting to a DB2 for i data server want to include physical tables/files, a
concept that is not familiar to those of us who dont develop on the DB2 for i
Select the objects you want to show in your database connection object.
For this article, ensure that all the options are selected.
The Object Name Filter column doesnt do anything in this window.
You can use
the following part of the Add Connection window to include or exclude objects
from a database connection. This is useful if you want to set up multiple
connections and even provide a layer of security over the database connections.
For example, perhaps you have a set of application DBAs who are responsible to
expose tables to application developers through views. While the application
DBAs likely need access to facets of the underlying database exposed in the
Solution Explorer, they are most likely to build routines that refer to a view
security layer and shouldnt be distracted with other objects such as tables,
XML source, and so on. As you can see in the following figure, there are
multiple connections with different filters in the Server Explorer:
you may want to set up multiple connections to the same database with different
user accounts to represent different stages or facets of the application
development life cycle. For example, perhaps you want to test a piece of code
with production authorizations, or Q/A authorizations, or design, and so on:
At this point, your Modify Connection window should look
similar to the following window:
10. Click Test Connection to
ensure that youve correctly specified the target data server and user account
authorized to connect to the target data server. If the test was successful,
you will receive a message confirming this fact:
At this point, you have a successful data server connection,
and from here you can perform any actions supported by the Solution Explorer,
start to build applications, and more.
Ready, Set, Develop...
In this article, I showed you how you can set up a database
connection object to a target IBM data server. In addition, I showed you all of
the unique and powerful features that are part of an IBM data server connection
in Visual Studio 2008.
You should experiment and get to know the filter
capabilities available for Visual Studio and IBM data servers; they are mostly unique
and not offered by other competitive databases. They provide a rich and
granular control framework that ultimately leads to better security and a more
rapid application development experience.
In future installments of this series, Im going to show you
how to build applications using Visual Studio 2008 and DB2 9 including a .NET
3.5 framework extension such as LINQ.
Addendum: Two Informix .NET Drivers?
When you create a data server connection in Visual Studio
2008, there are two drivers (shown at the top of the following list) that you
can use to connect to an IBM IDS server:
The IBM IDS Server is shipped as
part of the Informix Client SDK. The common driver for all IBM data servers is
the IBM DB2, IDS and U2 Servers driver. The IBM
IDS Server driver has been around for quite some time
(since IDS Version 7). You can get full details about this driver at: http://publib.boulder.ibm.com/epubs/html/25124470/25124470tfrm.htm.
This driver doesnt utilize the Distributed Relational Database Architecture
(DRDA) interface to communicate with an IDS server. In contrast, the IBM
DB2, IDS and U2 Servers uses DRDA (just as it would for a DB2
data server connection) but this common driver can only be used for IDS Version
11.10 or later data servers. Using the common driver for IBM data servers
provides you with common behavior for more efficient and predictable testing.
IBM DB2, IDS and U2 Servers is my recommendation
for any new .NET applications that you may write (assuming the new driver
supports all the features of Informix you need to leverage) In fact,
as it is enhanced over time, it will be in synch with the DB2 .NET provider
(since they have merged). Specifically, this common driver offers the following
features over the earlier IBM IDS Server .NET provider:
Schema metadata functions
Remote database enumeration
.NET framework 3.0 and 3.5 support
From a tooling perspective, the common driver uniquely
provides the following Visual Studio 2008 integration for a more rapid
application development experience:
Web application development
Internet Information Services (IIS) Web services generation
Designers to create tables, procedures, functions, and triggers
Designers to alter tables and triggers
The ability to view or alter data
Run procedures and functions
At the time of writing, the common driver doesnt completely
support all Informix server data types. For this reason, I generally recommend
that any new development be done with the new common driver whereas migrated applications
might still need functions provided by the IBM IDS
Server .NET provider. Over the next few releases of the IBM DB2, IDS
and U2 Servers driver, most of these migration issues should be addressed.
See All Articles by Columnist Paul C. Zikopoulos
IBM, DB2, DB2 Connect, Distributed Relational Database Architecture, DRDA,
i5/OS, Informix, iSeries, and z/OS are
trademarks or registered trademarks of International Business Machines
Corporation in the United
States, other countries, or
Microsoft and Windows
are trademarks of Microsoft Corporation in the United States, other countries, or both.
UNIX is a
registered trademark of The Open Group in the United States and other countries.
Linux is a registered
trademark of Linus Torvalds in the United States,
other countries, or both.
product, or service names may be trademarks or service marks of others.
International Business Machines Corporation, 2008.
solutions, and advice in this article are from the authors 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 authors knowledge at the time of writing.