Application Deployment and Other Goodies

Tuesday Jul 26th 2005 by DatabaseJournal.com Staff

Part 4 of this series examines an important yet sometimes overlooked topic – application deployment. No matter how great your application is, if you cannot deploy it with the same ease that you built it with, then you are going to end up with another set of problems to solve.

by Paul C. Zikopoulos, IBM Canada

In Part 1 of this series, I covered the richness of the IBM Explorer and its unique features that help Microsoft .NET application developers write applications for the IBM DB2 Universal Database (DB2 UDB) product on any platform. In Part 2 , I introduced you to a set of powerful schema creation wizards that let you point-and-click your way to the creation of database objects with extra features that make this process easier than ever. In Part 3, we looked at a whole bunch of features that make the day-to-day lives of application developers easier and put .NET-based DB2 UDB information at their fingertips. In this part of this series, I want to examine an important yet sometimes overlooked topic – application deployment.

In fact, deploying your applications requires just as much foresight from a database vendor as the development integration part. No matter how great your application is, if you cannot deploy it with the same ease that you built it with, then you are going to end up with another set of problems to solve.

I round off this article with some best-practice information for DB2 UDB application deployment, and describe some of the not-so-well-known utilities and new features that make DB2 UDB application deployment on the Windows platform easier than ever!

Getting the ADO.NET data provider for DB2 UDB on your system...

Once you have your application built, you need to put the code in place that supports communications between the client and the server. In the case of .NET, that is typically a native-managed provider. Unless you are using a Type 4 JDBC driver – which really doesn't fit into the .NET development model – you have to deploy a DB2 UDB client on your workstation (or put it in the middle tier for 3-tier architected applications) to get your application to talk to the DB2 UDB server. For this article, though, I will assume a 2-tier deployment model, which can be easily expanded to a 3-tier model.

Customers have sometimes commented on the size of the DB2 UDB clients. Before DB2 UDB Version 8.2, there were three types of DB2 UDB clients (Run-Time, Application Development, and Administration); the DB2 Run-Time Client packaged the minimum file set needed for the run-time connectivity for DB2 UDB applications. Even with the feature and file restriction efforts associated with the DB2 Run-Time Client, many customers found it too large and unsuitable for large deployments. Its size was due to the support for all the languages that DB2 UDB supports.

DB2 UDB V8.2 introduced a new repackaged and more efficient client for Windows, called the DB2 Run-Time Client Lite. This client provides all of the data application programming interfaces (CLI, ODBC, OLE DB, native .Net Data Provider, JDBC Type 2 and Type 4 drivers, SQLJ, and so on) and the network libraries required for applications that use these APIs to run. This client does not come with any tools or utilities. Because of this design restriction, its footprint has been reduced to a mere 12 MB. (The DB2 Run-Time Client is about 85 MB, by comparison.)

Unlike other DB2 clients, the DB2 Run-Time Client Lite is distributed both as a single executable (setup.exe) that can be used for installation and as a set of Windows Installer Merge Modules that can be directly embedded in an application's Windows Installer-based setup program.

The DB2 Run-Time Client Lite is available as Windows Installer Merge Modules (.msm files) for Windows Installer-based installations, which makes it easy to redistribute the client. The language is granular (which is the key contributor to reducing its size), so you select your files according to the language support you need. These merge modules are compatible with all authoring environments and the Merge Module 2.0 Object model.

Finally, the DB2 Run-Time Client Lite has its own terms and conditions, purposely delivered in a concise format in a simple text file. These terms and conditions detail the rules around the royalty-free redistribution license that IBM grants users of this client. Quite simply, you can embed this application in your application and not worry about licensing fees since DB2 UDB license fees are controlled at the server.

You can learn more about the DB2 Run-Time Client Lite in the DB2 UDB documentation or download the code with its royalty-free redistribution license at: http://www-306.ibm.com/software/data/db2/runtime.html.

For completeness, you can download maintenance for DB2 UDB servers and any DB2 client at: http://www-306.ibm.com/software/data/db2/udb/support/.

Now that you know you need a DB2 Client...decide how much code you need to distributed

So, now that you know you need a DB2 UDB client to get your application to talk to your database server, you need to consider how to distribute your code. You will be happy to know that DB2 UDB comes with a number of features that make this step easier than ever.

One issue that some customers run into is the size of the DB2 UDB installation image for the client or server code that they need to distribute in their enterprises or in support of their applications. I have already talked about how the compactness of the DB2 Run-Time Client Lite addresses this problem, but what about deploying a server or a different client? Hosting a full image of a DB2 UDB product when you only intend to install a subset of it can create such issues as network latency, hosting, and downloading. Customers have asked us for a method by which they could have a DB2 UDB image that would only include the components they need.

DB2 UDB V8.2 includes a new tool called the DB2 UDB for Windows Pruning Tool (db2iprune). You can use this tool to prune down the size of an installation image. You cannot use this tool with the DB2 Run-Time Client Lite since it already represents the minimum file set that you need to install for DB2 UDB connectivity. If you are installing a DB2 UDB server, or a different client, this can come in very handy and speed up and simplify the installation process.

Essentially, the db2iprune utility can be used to remove components from an installation image, thereby reducing its size. Before this utility was available, installation programs had to host a complete image for any DB2 UDB product installation – even if they did not want certain components. For example, let's say you are deploying a DB2 UDB Workgroup Server Edition server, but you do not require any of the data warehousing components that come free with this product. Without this utility, you would have to host the full image on your network servers. The reason for this is that DB2 UDB needed a way to ensure that no matter what components you chose to install, or not install, your selections could not break the installation process. While this safeguard method ensured the minimization of installation errors, depending on your distribution mechanism, it could result in a heavy load on your communications infrastructure (and imagine the effects over POTS – Plain Old Telephone Service).

With the db2iprune utility, you can remove components from an image and use the pruned image as the basis for distribution without concern to the impact of a selected component and its potential to break the installation process. For example, without this utility, you could not host an image that didn't include the data warehousing feature in a DB2 UDB server installation image (even if you didn't want to use it) because if someone ever performed an installation and selected this feature, the installation program would not be able to find it in the installation program and would throw an exception.

This all changed with db2iprune. After you prune an image using the graphical installer, pruned components will be unavailable for subsequent selection. If you use a response file installation program (I will cover that in a bit), the response file will simply skip over the pruned components that are not in the image (if they are specified) and note this anomaly in the installation log files.

You can learn more about the db2iprune utility in the DB2 UDB documentation.

Now you've got an image...you're ready to distribute the code

Once you have an installation image, you are ready to distribute your DB2 UDB client or server code. As mentioned in the previous section, if you are using the DB2 Run-Time Client Lite, you can use the .msm files to install the required .DLLs and drivers and make this process completely transparent to your application.

If you choose to distribute a different client or DB2 UDB product, you can use a response file installation – often called a silent installation. This installation method is what is used to distribute DB2 UDB software in an enterprise to a large number of target destinations. Basically, a simple .TXT file (shown below) is used to identify the components that should or should not be included in the installation. No user intervention is required whatsoever, so it is a vital tool for software distribution.

Each DB2 UDB product comes with a sample response file that you can use as a starting point which is tailored for your deployment purposes. In addition to this, DB2 UDB V8.2 introduced the ability to specify that you want a response file created from the GUI-driven installation program, which makes things a lot easier: the simplicity of a GUI and the flexibility of the response file.

You can learn more about using response files to install DB2 UDB products in the DB2 UDB documentation. I will also discuss an amazing utility that is available on the Windows platform in the "READ THIS: Now for some hints and tips for DB2 UDB product distribution" section.

by Paul C. Zikopoulos, IBM Canada

Do you use Microsoft Systems Management Server?

You can also distribute your DB2 UDB code via the Microsoft Systems Management Server (SMS) product. You can use Microsoft SMS to install DB2 UDB across a network, and set up the installation from a central location using a push or pull strategy. Such an installation will minimize the amount of deployment work that you have to perform in a Windows environment. This installation method is ideal if you want to roll out an installation on a large number of clients all based on the same setup. (Moreover, since an SMS CAL license is part of the Microsoft Core CAL license, there is a good chance your enterprise is already licensed for this technology.)

When you are using Microsoft SMS, you have control over which response files you will use. You can have several different installation options, resulting in several different response files. When you configure the installation package, you can specify which response file to use.

Like any other product that you want to distribute via Microsoft SMS, you need to create an SMS package, which is a bundle of information that you send from the SMS server to an SMS client. This package consists of a set of commands that can be run on the client workstation. These commands could be for system maintenance, changing client configuration parameters, or installing software.

The screen shots below depict the integration between DB2 UDB and Microsoft SMS:

You can learn more about this method of installing DB2 UDB products at: http://publib.boulder.ibm.com/...t0007297.htm.

The code is installed; now what?

At this point, you have installed a DB2 UDB client and you need to configure connections to the required databases and potentially perform configuration work on each of these client workstations (setting registry variables, and so on). There are many ways to do this in DB2 UDB, and your experience and comfort level with DB2 UDB will likely guide you to the right path.

Microsoft .NET developers can leverage the rich configuration features in the IBM Explorer that I covered in Part 1 of this series. You can catalog and add databases that you are authorized to connect to with mere clicks of a button.

Power users are likely to use the DB2 UDB Configuration Assistant's Add Database Wizard, shown in the figure below:

The Configuration Assistant provides a graphical environment for configuring connections and settings for DB2 UDB workstations. It provides a full set of the discovery functions that were added to VS.NET, as well as alternate methods for cataloging database connections and testing them. Quite simply, you can ask DB2 UDB to send out messages across your network in order to find any DB2 UDB servers and automatically catalog them. Of course, you need to have the correct authorization and authentication credentials to access these databases, and database administrators (DBAs) have the option to configure DB2 UDB not to respond to these requests at a per database level, but it's a handy feature indeed – especially for developers!

You can also use the Active Directory protocol to centralize the administration of catalog information for database connections. Using Active Directory provides a central server that hosts catalog information for database connections that developers need to do their work. When they need to connect to a database, they simply specify the database name and the DB2 client contacts the Active Directory server to retrieve the required connection information. This environment requires a little more setup and attention to detail, but provides an easy administrative framework once it is up and running since you only need to change, delete, or add connection information in one place. The DB2 UDB GUI tools and the CLP commands have extensions for LDAP directory servers.

An example of a database connection assisted by Active Directory is shown below:

Finally, you can use client profiles (which are generated from the command line or by one of the graphical DB2 UDB tools) to generate text files that contain the configuration information of a DB2 UDB product. For example, you can catalog any required database connections and set registry variables on a single machine, and then export that machine's profile, and subsequently import it on any target workstation.

READ THIS: Now for some hints and tips for DB2 UDB product distribution

In this final section, I will give you some hints and tips that seem to provide a best-practice framework for DB2 UDB production deployment

(A) You don't have to be a baker to cut cookies

The DB2 UDB Response File Generator utility (db2rspgn) is a virtually unknown Windows-only utility that might prove to be your best friend. For all intents and purposes, this tool is a 'cookie-cutter'. If you look back through this article, you will see there are various mechanisms to include or exclude components in a DB2 UDB installation, and to set up configuration information such as database connections, and so on. The db2rspgn tool allows you to fully configure a machine with all the components, database connections, registry variable settings, and so on. When you run this tool, DB2 UDB automatically creates the response file and profiles that will allow you to duplicate that workstation's DB2 UDB image and configuration on any target workstation. Underneath the covers, this tool invokes some of the profiling capabilities I mentioned earlier, but using this utility is a more streamlined and easier process. I recommend you follow this method versus setting up your own response file, creating profiles, and so on.

(B) Hide Your Installation

DB2 UDB V8.2.2 introduced a host of new features that you can use to hide the installation of DB2 UDB in your own product's installation. If you are embedding DB2 UDB in your product's installation, get to know these features! For example, as of DB2 UDB V8.2.2, you can completely suppress any of the DB2 UDB dialog boxes and simply show a status bar that shows the progress of the DB2 UDB installation, override user account settings in a response file, and more. SAP is a prime example of an application that installs DB2 UDB for its customer base. The new version of SAP leverages these key new features to make the installation of the database server as transparent as possible.

(C) Use the DB2 Run-Time Client Lite

For simple connectivity, give the DB2 Run-Time Client Lite to your production people to enable your application for a DB2 UDB database. It is simply a collection of drivers (including .NET, OLEDB, ODBC, SQLJ, and so on). In fact, it includes all the drivers you will ever need for any application, no matter what the language. Remember, you do not have to ask IBM for permission to redistribute it. It is very easy to deploy the DB2 UDB client code this way: you just build the installation program for your application and you include the MSI merge modules that you need – no need for response files or anything!

Wrapping it all up

In this article, I covered the key topics, information, and tools that you need to be aware of to easily deploy the DB2 UDB product that is a pre-requisite to your application.

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: http://www14.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 Technology team. He has more than ten years of experience with DB2 UDB and has written over sixty magazine articles and several 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). In his spare time, he enjoys all sorts of sporting activities, running with his dog Chachi, and trying to figure out the world according to Chloë – his new daughter. You can reach him at: paulz_ibm@msn.com.


IBM, DB2, and DB2 Universal Database, 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.

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

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


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.

Mobile Site | Full Site