4.3.3 Considerations for deployment of CLI and ODBC applications

For scenarios where the IBM Data Server Client or Runtime Client has already been installed, deploying a C/C++ application is straightforward. You only have to install the application on the target system and then catalog locally the database to which the application is going to connect. During runtime, application directly reads connectivity information from the local catalog.

In this section, we discuss a different case where an application is to be deployed to an environment without the DB2 Client. The IBM Data Server Driver for ODBC and CLI is thus required to be deployed along with the application.

Redistributable driver files

The IBM Data Server Driver for ODBC and CLI is a freely downloable product. There are conditions required for redistributing the IBM Data Server Driver for ODBC and CLI with an application. We describe this in more detail in 4.1.2, “IBM Data Server Driver for ODBC, CLI, and .NET, and IBM Data Server Driver for ODBC and CLI” on page 143. Make sure that all the required conditions are met prior to packaging the driver with your application for deployment.

Connecting to database

After deploying C/C++ applications that use the IBM Data Server Driver for ODBC and CLI, some application configuration may be required depending on the connecting method the application used. There are five ways to specify the connectivity information if the application is working only with IBM Data Server Driver for ODBC and CLI:

￿Save connectivity information in a connection string and call SQLDriverConnect() to establish a connection. No particular application specific configuration is required if you use this method and specify database, host, and port in the connection string. This is the method used in our C/C++ application deployment example.

￿Use the CLI initialization file, db2cli.ini, to configure the connection. This method is for CLI applications only, and db2cli.ini change is required.

￿Register the database as an ODBC data source with the ODBC manager. This is required for the ODBC application only. db2cli.ini or other platform specific configuration changes are required.

￿Use the FileDSN CLI/ODBC keyword to specify database connectivity information. db2cli.ini, or other platform specific configuration changes that are required.

￿For a local database only, use PROTOCOL and DB2INSTANCE CLI/ODBC keywords to specify the local database. db2cli.ini change is required.

158DB2 Deployment Guide

Page 172
Image 172
IBM DB2 Considerations for deployment of CLI and Odbc applications, Redistributable driver files, Connecting to database