Enable pureQuery for the IBM Data Server Provider for .Net
The IBM Data Server Provider for .Net, which is IBM's recommended .NET data provider for DB2 databases, has been extended to provide pureQuery functionality that enables you to selectively dynamically or statically execute an application's SQL without having to modify your existing application. This pureQuery-enabled provider is included in the following products:
- IBM Data Server Driver for ODBC, CLI, and .NET, Version 9.5.3 (or later)
- IBM Data Server Runtime Client, Version 9.5.3 (or later)
- IBM Data Server Client, Version 9.5.3 (or later)
- DB2 for Linux®, UNIX®, and Windows®, Version 9.5, Fix pack 3 (or later)
The provider's pureQuery functionality is a separately licensed feature and is disabled by default. To unlock the functionality, you must acquire an IBM Data Studio pureQuery Runtime license and apply it. This section of the tutorial walks you through the process of installing the pureQuery Runtime and shows you how to apply the pureQuery license.
To install your licensed pureQuery Runtime on the machine where your .NET application resides, download it from Passport Advantage and follow the simple instructions that are well documented in the pureQuery Runtime installation section of the Integrated Data Management Information Center. (See Resources for a link to the Information Center to access the instructions.)
The pureQuery license activation steps vary depending on which of the above products you have installed.
If you installed the IBM Data Server Driver for ODBC, CLI, and .NET, copy the license file dspq_rt.lic, which you can find in the (default pureQuery Runtime installation) directory C:\Program Files\IBM\Data Studio pureQuery Runtime\pureQuery\, to the driver's licence directory. This .NET provider license directory is located by default in C:\Program Files\IBM\IBM DATA SERVER DRIVER\license\.
If you installed the .NET driver as part of another DB2 client or as part of a data server, use the DB2 License Center or run the DB2 license management command, and specify the full path and license file name as a command line parameter:
db2licm -a "C:\Program Files\IBM\Data Studio pureQuery Runtime\pureQuery\dspq_rt.lic"
Once you've activated the pureQuery license, you are ready to step through the process that enables your existing application for pureQuery.
The pureQuery functionality of the IBM Data Server Provider for .Net is configured by adding custom properties to the application's database connection string. To keep it simple, this tutorial uses the testconn20.exe utility as the .NET application, which is included in DB2 client and data server installations (in the C:\Program Files\IBM\SQLLIB\BIN\ directory). This utility is commonly used to validate that the IBM Data Server Provider for .Net is configured correctly. It takes as an argument a database connection string, which can be easily manipulated, as shown in Figure 4. The utility only accesses catalog tables and can therefore be used with any database. For illustrative purposes, this tutorial uses the GSDB database, which is commonly used as a data source in Data Studio tutorials.
Figure 4. Example program output
If you prefer, you can follow this tutorial using an application that you've developed and that you are familiar with as long as you can manipulate its database connection string.