Connecting Windows Applications to IBM Databases

A Joint White Paper by StarQuest Software, Inc. and Microsoft Corporation, August 1998

SAMPLE IMPLEMENTATIONS FOR DATA SHARING 

CONCLUSION 

APENDIX 1: SNA SERVER CONFIGURATION 

APPENDIX 2: STARSQL DATA SOURCE DEFINITION 

APPENDIX 3: IMPORTING DB2 DATA INTO EXCEL 

APPENDIX 4: SAMPLE HTML AND ACTIVE SERVER PAGE 
 

APPENDIX 5: SAMPLE REPLICATION SUBSCRIPTION 

APPENDIX 6: SAMPLE MTS CONFIGURATION 


Introduction

The requirement to share data between PC systems and IBM DB2 relational databases has grown significantly in the last several years. Businesses understand the advantages of sharing data to bring products to market sooner, develop applications and make critical business decisions on all levels. 

This document discusses why sharing DB2 data in the PC environment has become critically important. For comparison purposes, traditional data access methods are covered. Current trends for direct data sharing are discussed, as well as the enabling technologies that make these solutions fast, effective and scalable. Finally, we'll review how StarQuest and Microsoft products work together to provide complete, easy-to-implement data sharing solutions.

As a practical demonstration, appendices show samples of the components discussed in the document and examples of actual configurations and code segments for implementation. Each of the solutions discussed in the document are constructed by combining various elements in the appendices. 
 

Fulfilling The Need For Data Sharing

 
Organizations are increasingly relying on IBM's DB2 for database storage and on Window-based products for desktop operations. 

The PC desktop is the fastest growing segment of the computer industry and more users are leveraging Microsoft Technology than ever before - over one million copies of Windows are sold each month. Organizations are using Microsoft operating systems on PC desktops to run productivity enhancing software packages: word processors, spreadsheets, decision support tools, report writers or their own custom applications. 

At the same time, many organizations rely on IBM mainframe and midrange systems as the repository of their data assets. IBM's relational database DB2 has become the most popular method for storing and protecting corporate data in the IBM environment. With more than 400,000 licenses worldwide, DB2 makes up roughly 70 percent of the relational databases in use today - more than all other RDBMS combined (Source: IDC). 

As more organizations push decision-making throughout all ranks of the corporate hierarchy, fulfilling the need to share data between the PC desktop and DB2 environment has become a critical business requirement. The general consensus is that by enabling data sharing, organizations become more effective and more profitable by making better use of the components of their information services infrastructure. 
 

TRADITIONAL APPROACHES TO SHARING DATA 

In illustrating where improvements have been made, it is useful to consider how organizations have traditionally enabled data sharing. Until recently, vendors providing PC-to-host database access have relied upon a variety of indirect methods: 
 
Traditional, indirect data access methods, which include screen scraping, file transfer, and program-to-program communications, are considered cumbersome, inefficient and complex. 
 

  • Screen Scrapers 
    Screen scrapers provide an application programming interface (API) by which an application on the PC may access selected fields of an IBM host screen image, for example, a 3270 or 5250 screen image. An application can issue commands via the API that either read or replace data in screen fields, thereby getting information from the host or sending data to the host for updates. 

    This approach solves the problem of providing corporate data to local applications, but it still requires an application resident on the host for the terminal emulation operations. Another problem is that users receive a limited view of data, restricted to the fields selected by the host application. 

  • File Transfer 
    File transfer utilities take entire data files from the host and deliver them to the local client or LAN database. Although this method enables data to be leveraged by local applications, it can consume inordinate amounts of network bandwidth and local CPU cycles, especially for data accessed often. Moreover, time and resources are wasted transferring whole files when the user needs only a few pieces of information.
  • Advanced Program-to-Program Communication (APPC) Cooperative processing applications, such as those that use IBM's APPC or LU 6.2 technologies, enable a PC application to communicate with an application on the host. While this method provides a more direct way to access corporate data, it requires new, custom applications on both the client and the host. These custom applications, in turn, call for programmers who are adept at advanced IBM connectivity protocols. 

All of these methods have some inherent drawbacks, making them, when considered together, cumbersome, inefficient and complex. It is for these reasons that organizations continue to demand a seamless, transparent access method.
 

DIRECT DATA SHARING MODELS 

There are three primary data sharing models for direct access: two-tiered, three-tiered and distributed architecture. 
 

  • Two-tiered Model 
    An example of the two-tiered solution is a user connecting directly to a RDBMS with an application. The application could be a common spreadsheet tool or some custom developed application. 

 
Various tiered architectures provide options for organizations to access data directly.  
 

  • Three-tiered Model  
    In the three-tiered model, a user is connected to an intermediary system that interfaces with the RDBMS as the result of some action taken by the user or at some regular interval. The primary three-tiered implementations include accessing RDBMS through a web browser, data marts and transaction processing models.
  • Distributed Architecture 
    The number of systems between the RDBMS and the user becomes implementation dependent. With Distributed Architecture, the number of  intervening systems can be essentially unlimited. Hence the more generalized model of Distributed Architecture has arisen. 

For direct access using any of these models, Microsoft and StarQuest provide a solution that combines the power and reliability of Microsoft SNA Server with the high performance of StarQuest's StarSQL database access software. 
 

THE ENABLING TECHNOLOGIES FOR DIRECT ACCESS 

Enabling technologies that utilize open standards, provide users with stability and flexibility, independent of their technology migration path. All of the direct data sharing models for PC systems and DB2 shown are implemented with the following enabling technologies. 
 

  • Open Database Connectivity (ODBC) 
    Defined by Microsoft and adopted by the SQL Access Group, ODBC is a standard application programming interface (API) for database access that is completely data source- and vendor-neutral.  As such, ODBC enables desktop applications to access most major relational databases through a single, standard interface, thereby eliminating the need to implement software drivers for each data source. 

    In addition to incorporating SQL Access Group standards, ODBC leverages ANSI-standard SQL and ISO standards for interoperability.  As a result, ODBC enables desktop users to access one or more relational database management systems concurrently, including DB2 (using StarSQL Pro), and Oracle, Sybase, or Informix (using other ODBC drivers). 

    Since its adoption by the SQL Access Group and X/Open, ODBC has generated broad support throughout the industry. Hundreds of application software suppliers, including nearly all major Windows vendors, are supporting ODBC in their packages. 

 
StarSQL bridges Microsoft's ODBC and IBM's DRDA to provide transparent data access  

  • Distributed Relational Database Architecture (DRDA) 
    Defined by IBM for managing relational data within and among IBM systems, DRDA is a set of rules or protocols for accessing, requesting, transmitting, and managing distributed relational data.  DRDA utilizes portions of IBM's Systems Network Architecture (SNA) framework to ensure data integrity and security, enabling multiple requesters to access IBM's databases through DRDA without disruption to the core data. DRDA governs such functions as user sign-in and table access, among others. 

    IBM released the first levels of DRDA in 1992, and industry support has steadily gathered momentum since then. Today, DRDA-enabled databases include DB2 for MVS mainframes, DB2 for VSE mainframes (formerly known as SQL/DS), DB2/400 for AS/400 midrange systems, and DB2.1 and above for AIX, HP-UX, Solaris and Windows NT. 

  • SNA Server 
    Microsoft SNA Server is an SNA gateway that provides SNA communications for LAN-based services and multiple platform PC workstations running a variety of network protocols. SNA Server employs a client-server architecture that is tightly integrated with, and leverages the strengths of, Microsoft Windows NT Server. 

    Communication to the host takes place over link protocols and media supported by Microsoft SNA Server, (the hardware on which SNA Server runs), and the hardware of the host. For example, links may be Token Ring, Ethernet, Synchronous Data Link Control (SDLC), or channel attachment. 

    StarSQL maps ODBC calls into DRDA requests for transmission to the IBM host.  

    Connection to the host normally is through standard SNA facilities of IBM host processors. In MVS systems, this is typically through front-end processors running Network Control Program (NCP) and through Virtual Telecommunications Access Method (VTAM) facilities. Using channel attachment hardware, users can bypass front-end processors. 

    (See Appendix 1: Sample SNA to VTAM Configuration) 

 

  • StarSQL Data Access Middleware
    StarSQL is a client-based data access middleware driver that translates ODBC calls into DRDA-formatted requests for use with local or remote DB2 databases. No special hardware or host software is needed because StarSQL runs on the client. 

    Acting as the bridge between ODBC-enabled Windows applications and DB2 data, StarSQL brings host data directly into any ODBC-enabled application, column-by-column, row-by-row, and record-by-record. StarSQL implements the latest ODBC API, Version 3 Level 2 and DRDA Level 3. 

    The StarSQL ODBC driver supports Windows 3.X, Windows for Work Groups, Windows 95 and Windows NT. StarSQL is bundled with MS SNA Server. The bundled version allows for 10 concurrent connections from a single CPU. Users purchasing additional licenses from StarQuest Software, get additional StarSQL Pro features and direct technical support. 

    (See Appendix 2: Sample Data Source for Connecting to DB2 on MVS) 

Sample Implementations For Data Sharing 

 
Direct database access provides a faster, more convenient solution when using any Windows application.  
 

IMPLEMENTING TWO-TIERED SOLUTIONS 

In the two-tiered model, client applications are connected directly to DB2. With direct database access, a Windows application such as Excel can access any IBM relational database. 
 
This has many benefits. Local users can work in the applications they are familiar with to do analysis on the data they need.  Only the necessary data is transferred to and from systems. This means the solution is fast and efficient. In addition, the queries and updates are using the database system rules, guaranteeing data integrity. 
 
The applications used to do analysis on the data run on the PC, which reduces CPU loads on the host and leverages the lower cost desktop CPU. Software development costs are much lower on the PC and end-users prefer point-and-click applications over traditional green screen applications. 
 
In a two-tiered solution, direct data access makes data available in a seamless, one step operation. Using this simple and low cost method with spreadsheets, word processors, decision support tools and report writers, users are empowered with the information they need. 

Queries executed remotely via DRDA utilize less CPU than the identical query submitted locally via the IBM Query Management Facility (QMF), a host-based query tool. In addition to the CPU savings, providing a direct connection to clients eliminates the multi-step processes of executing queries on the host, then translating and transferring the data to the client system. 

  
 This figure illustrates the efficiency of the two-tiered model from the host CPU perspective.  

There are hundreds of applications available for decision support, reporting, data mining, and On-Line Analytical Processing (OLAP) that can be used effectively in the two-tiered model. The most important factors for choosing a two- tiered solution are the need for up-to-the-minute data or the need to update the database. 
 
The two-tiered solution can be implemented with Microsoft SNA Server, the bundled StarSQL driver and any ODBC-enabled application, such as Excel, Visual Basics or PowerBuilder. 
 

IMPLEMENTING THREE-TIERED SOLUTIONS 

Three-tiered solutions are represented by the following implementation models: Web Server Publishing, Data Marts and Transaction Processing. 
 
Each of these solutions offer specific application values that make them among the most useful and sought after systems today. Through a collaboration with StarQuest, Microsoft has provided the ability to implement all three of these models possible to implement with Microsoft's BackOffice suite. 
 

  • Publishing DB2 Data on the Web 
    Many first generation Web Servers published static Web pages. In this model the data displayed is unchanged regardless of who is viewing it. One of the first challenges for creating more useful web sites is to provide users with access to dynamic data specific to the viewer. 

    Using the standard features of the Microsoft Internet Information Server (IIS), SNA Server users can execute queries and publish DB2 data directly into Web pages. Microsoft IIS provides an ODBC interface through their Active Server Pages (ASP) interface. Once access is provided to ODBC, StarSQL can be used to provide a connection to DB2 via SNA Server. 

 

    Microsoft Back Office components IIS, SNA Server and StarQuest's StarSQL connect a Web server to an IBM host for publishing dynamic data on a browser client.  

    The result is a Web server that can combine static web pages with dynamic data from the company's corporate DB2 database. For example, the Web page of an air freight company might get HTML pages from a local file and dynamic data from a remote DB2 database. This would allow a customer to enter an air bill number in a Web page to request up-to-the-second information on their package. 

    An IIS Web server has the ability to access relational databases using the Active Server Pages.  The ASP uses ODBC drivers to access relational databases and can use StarSQL or other ODBC-to-DRDA drivers to access DB2.  The Web server connects to the IBM host through SNA Server. 

    (See Appendix 3: Sample HTML and Active Server Page) 
     

  • Data Marts 
     

A data mart is a subset of data collected at a site for the purposes of department- specific analysis. Data is copied from the central data repository and refreshed on a periodic basis. The local data mart is then used for resource intensive activities not suitable for execution on the production system responsible for managing the day-to-day data processing. 
 
SNA Server connects Web server to IBM host providing replicate data.  

    Microsoft BackOffice makes setting up data marts fast and easy. Microsoft SQL Server and StarQuest Data Replicator (SQDR), used in conjunction with SNA Server and StarSQL make up the components of the data mart solution. Client systems then use the tools of their choice to perform analysis on replicated data. 

    Through the use of graphical administration tools and easily customizable options, StarQuest Data Replicator allows you to accomplish robust and efficient bi-directional snapshot replication of data between Microsoft SQL Server and multi-platform DB2 databases. 

    One of the frequently used applications for data replication is decision support. Typically, these applications do not need the most up-to-date information. For example, it usually does not matter when studying monthly and annual business trends to have data that is up-to-the-second. 

    Often, production data processing systems do not store historical data in DB2 that may be valuable for trend analysis and similar decision support applications. One solution is to schedule regular SQDR replications from DB2 to SQL Server thereby accumulating needed historical data. Over time, this replication creates a data warehouse that is valuable for historical analysis and other purposes. 

    (See Appendix 4: Sample Replication Subscription) 

    Once selected, the database subset in SQL Server is easier to manage and use than the huge database superset in DB2. 

 

  • Microsoft Transaction Server

    In this three-tiered model, users can keep connections open, schedule work loads and service many clients. 

 
MTS has many powerful features that facilitates three-tiered and Distributed Architecture client/server solutions. 

    The Microsoft Transaction Server (MTS) allows developers to create efficient applications that provide high speed transaction processing services.  MTS is designed for three tiered application development. It provides a multi-threaded capability that reduces the time it takes to create and execute instances of server-based objects. This connection pooling improves performance by reducing the number of steps required for execution of a resource. 

    (See Appendix 5: Sample MTS Connection Pooling Registry Entry) 

 
A multi-tiered solution incorporates Web Server, Transaction Services and a Data Mart.  
 

IMPLEMENTING DISTRIBUTED ARCHITECTURE SOLUTIONS 

By using components from the basic three-tiered model, new solutions can be crafted that exploit the benefits from each individual component  In the example, a multi-tiered solution incorporates a Web Server, Transaction Services and a Data Mart. Users replicate data to SQL Server, use Transaction Server for efficient access to data and use IIS to publishing data. The result is a fast, broad bandwidth method for publishing data to the Web with minimal impact on the host system. 
 

Conclusion 

The StarSQL/SNA Server combination fulfills the need for data sharing– providing a compelling solution to PC-to-host data access requirements today. By delivering a simple and elegant means for Windows users to pull corporate data directly into their familiar desktop environment, without compromising the security and integrity of the data, StarSQL and SNA Server have leveraged today's standards to provide a real-world solution to a pressing data access problem. 

In the past, building client server and distributed architecture solutions for DB2 has been a difficult undertaking. Now, through a partnership between Microsoft and StarQuest, organizations can quickly construct powerful data sharing solutions. 

All of the solutions in this document are constructed with components of Microsoft BackOffice. They all share a common connection to DB2 via StarSQL and SNA Server. In the appendices is a sample configuration for connecting SNA server to MVS, instructions to enable DB2 for remote access and a matching configuration for a StarSQL data source. Sample code for IIS integration, SQDR configurations and MTS Connection Pooling are also included. The examples are matched and designed to be step-by-step implementation instructions. 

StarQuest and Microsoft have made sharing DB2 data as easy as sharing data from any other RDBMS. All of the solutions are standards-based and will provide immediate value for almost any organization. If you have Microsoft BackOffice, you have everything you need today to begin enjoying the benefits of sharing DB2 data in your organization. 

For the future, StarQuest Software foresees adding access to more DRDA databases as well as offering that access across a wider variety of client platforms, including UNIX and Macintosh systems. In addition, as ODBC continues to gain momentum as the industry's de facto standard data access API, more applications will be able to leverage StarSQL. 

For more information:  
Contact your local Microsoft office or a Microsoft Certified Solution Provider near you. In the United States, call 1-800-426-9400 for product information or to locate a Microsoft Solution Provider. In Canada, call 1-800-563-9048. Outside the United States and Canada, call your local Microsoft subsidiary or 206-936-8661. Via the Internet, www.microsoft.com

Contact StarQuest Software in Berkeley, California, USA at 1-800-763-0050 from anywhere in the United States or Canada. From elsewhere call 510-528-2900. Via the Internet, www.starquest.com or email: sales@starquest.com. 

 
© 1998 Microsoft Corporation and StarQuest Corporation. All rights reserved. This document is for informational purposes only. 
MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED,  IN THIS SUMMARY. Microsoft, Visual Basic, Windows, MS-DOS are registered trademarks and Windows NT is a trademark of Microsoft Corporation. IBM, OS/2, OS/400, AS/400, and NetView are registered trademarks and MVS/ESA, ACF/VTAM and ES/9000 and SAA are trademarks of International Business Machines Corporation. UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Co. Ltd. All other trademarks or registered trademarks are the properties of their respective owners. 

APENDIX 1: SNA SERVER CONFIGURATION

This section includes a sample configuration between VTAM on MVS and a Microsoft SNA Server. The parameters from this configuration are referenced in the configuration of StarSQL Data sources described in another section.

VTAM MVS
Sample Configuration

1. PU/LU - A PU must be defined in VTAM by the VTAM systems programmer. Figure 1 is an example of a PU with an Independent LU.

*** StarSQL can use Independent and Dependent type of sessions to communicate to the database. For an example of a PU w/Dependent LUs, please refer to the StarSQL Pro online help file.

- Figure 1 -

STAR2 PU ADDR=02, IDBLK=05D, IDNUM=10092, DLOGMOD=LU62STAR, >MODETAB=MODELU62, SSCPFM=USSSCS, PUTYPE=2, MAXDATA=521, MAXPATH=1, PASSLIM=4, DISCNT-NO, ANS=CONT, PACING=0

STARLU LU LOCADDR=0, PACING=0, VPACING=0

2. Mode -The Mode Table entry contains information governing how conversations take place in VTAM; they define pacing, RU sizes and COS (class of service parameters). One of the most important entries in the LOGMODE table is the PSERVIC field which identifies the LU traffic protocols. The mode entry can be placed in any mode table under VTAM, the default or the same one used by DB2 in the APPL statement (see below) for DB2's LU definition.

LU62STAR MODEENT LOGMODE=LU62STAR, FMPROF=X'13', TSPROF=X'07', PRIPROT=X'B0', SECPROT=X'B0', COMPROT=X'50A1', RUSIZES=X'8989', TYPE=0, PSNDPAC=X'03', SRVCPAC=X'03', SSNDPAC=X'02', PSERVIC=X'060200000000000000002F00'3. APPL
DB2APPL VBUILD TYPE=APPL LUDB2T APPL AUTH=(ACQ), APPC=YES, AUTOSES=1, DMINWNL=10,  DMINWNR=10, DSESLIM=20, MODETAB=MODEDB2, SECACPT=ALREADYV, SRBEXIT=YES, VERIFY=NONE, VPACING=2 

onPool is locatedMicrosoft SNA Server Sample Configuration 
 
 
SNA Server Config Matching VTAM and DB2 Parameters 
MODE LU62STAR 
Mode Name LU62STAR 
Comment  
Session Limit 20  DSESLIM (APPL Definition)  
Min Con Winners 10 DMINWNR (APPL Definition) 
Min Con Losers 10 DMINWNL (APPL Definition) 
Autoactivation Lim 1 AUTOSES (APPL Definition) 
Enable Autopartner Yes 
High Priority Yes 
Pacing Send Count 7  SRVCPAC (MODE Definition) 
Pacing Recv Count 7 PSNDPAC (MODE Definition) 
Max Send RU 4096 RUSIZES (MODE Definition) 
Max Receive RU 4096 RUSIZES (MODE Definition 
SERVER STARSERV 
Server Name STARSERV 
Comment  
Control Point Name STAR2 PU/CPNAME or PU Name(PUDefinition) 
Network Name STARW VTAM NetID 
   
Link Services associated with this Server: 
SNADLC1 SnaDlc1 

Connections associated with this Server: 
DB2MVS 802.2 Connection 

APPC Local LUs associated with this Server: 
STARLU  

LINK SNADLC1 

Link Service Name SNADLC1 
Server Name STARSERV 
Comment SnaDlc1 
Link Service Type Token Ring 

Connections associated with this Link Service: 
DB2MVS 802.2 Connection 

CONNECTION DB2MVS 
Connection Name DB2MVS 
Server Name STARSERV 
Comment 802.2 Connection 
Remote End Host 
Activation type Initially Active 
Call Direction Both 
Local Block Number 05D IDBLK (PU Definition) 
Local Node Number 10092 IDNUM (PU Definition) 
Control Point Name PAPACDRM VTAM SSCPName 
Network Name STARW VTAM NetID 
Remote Block Number  
Remote Node Number  

Primary Link Service SNADLC1 

Connection Type 802.2 DLC 
DLC Type Token Ring 
XID Format Format3 
Remote Network Address 420000000400 HOST Network Address 
Remote SAP Address 4 /Use defaults for remaining 
Max BTU Length 1493 /link parameters or refer to  
Receive ACK Threshold 2 /SNA Server Help 
NAK Send Limit 8 
Retry Limit 10 
XID Retry Limit 3 
T1 Timeout Default 
T2 Timeout Default 
Ti Timeout Default 
Reactivation Delay Default 
Reactivation Retry Limit None 

3270 LUs assigned to this Connection: 

No LUA LUs assigned to this Connection. 

 No Downstream LUs assigned to this Connection. 

APPC LUs assigned to this Connection: 
LUDB2T  

APPCRLU LUDB2T  

LU Alias LUDB2T DB2 APPL 
Connection Name DB2MVS 
Network Name STARW 
LU Name LUDB2T 
Uninterpreted LU Name LUDB2T 
Comment  
Parallel sessions Yes 
Automatic partnering Yes 
Session level security None 
Implicit Mode <none> 

Partner LUs and modes: 
STARLU LU62STAR 

APPCLLU STARLU 

LU Alias STARLU Independent LU (VTAM) 
Server Name STARSERV 
Independent LU Yes 
Network Name STARW 
LU Name STARLU 
Comment  
Automatic partnering No 
Member of def. pool No 
Implicit remote LU <none> 
Timeout for TP start 60 

Partner LUs: 
LUDB2T LU62STAR DB2MVS  

APPENDIX 2: STARSQL DATA SOURCE DEFINITION  

This section shows how to configure DB2 on MVS to accept request from StarSQL over SNA Server.
Parameters in the section are referenced in the section on defining a StarSQL data source.
 

Distributed Data Facility 

The Distributed Data Facility (DDF) is a component of your IBM database.
Its primary task is to route data from one database to another or from a client to another client (distributed unit of work).
If distributed data has never been implemented it may not be configured. DDF must be active in order to make a successful connection to DB2 using StarSQL Pro.
 

During startup processing to obtain system installation parameters, DB2 reads the BSDS (Bootstrap Data Set).
One of the records stored in the BSDS is the DDF record. This records contains information used by DDF to connect to VTAM.
If your organization has not implemented distributed database capabilities, DDF may not be configured. 
 

a) If you are in the process of installing DB2, use the DDF installation panel DSNTIPR to provide: 

  • - The location name for the DB2 system
  • - The LU name for the DB2 system
  • - The password used when connecting DB2 to VTAM


b) If DB2 is already installed, use the change log inventory utility (DSNJU003) to update the information in BSDS. Below is an example of how a BSDS is updated with a location name of STARDB, LU name of LUDB2T, and a password of STARPASS.

//SYSADMB JOB ,'DB2.3 JOB',CLASS=A
//*
//* CHANGE LOG INVENTORY:
//* UPDATE BSDS WITH
//* - DB2 LOCATION NAME FOR STARDB
//* - VTAM LUNAME (LUDB2T)
//* - DB2/VTAM PASSWORD
//*
//DSNBSDS EXEC PGM=DSNJU003
//STEPLIB DD DISP=SHR,DSN=DSN230.DSNLOAD
//SYSUT1 DD DISP=OLD,DSN=DSNC230.BSDS01
//SYSUT2 DD DISP=OLD,DSN=DSNC230.BSDS02
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN DD * 

DDF LOCATION = STARDB, LUNAME=LUDB2T, PASSWORD = STARPASS

Note if a password is not required to connect DB2 to VTAM, leave it blank.

c)Starting DDF - To start the distributed data facility (DDF), if it has not already been started, use the following command:
>-START DDF
 

Using the START DDF command requires authority of SYSOPR or higher. The command causes the following messages to appear: 

DSNL003I - DDF IS STARTING 
DSNL004I - DDF START COMPLETE LOCATION locname LU netname.luname 

If the distributed data facility has not been properly installed, the START DDF command fails and message DSN9032I, - REQUESTED FUNCTION IS NOT AVAILABLE, is issued. If the distributed data facility has already been started, the START DDF command fails and message DSNL001I, - DDF IS ALREADY STARTED, is issued. 

SYSLUNAMES 

You must have an entry in SYSIBM.SYSLUNAMES to allow the local LU access to DB2. 

a) You can insert a row which contains default values for any LU to use, which is not specifically described. The default row will contain blanks in the LUNAME column. An example: 

INSERT INTO SYSIBM.SYSLUNAMES (LUNAME, SYSMODENAME, USERSECURITY, ENCRYPTPSWDS, MODESELECT, USERNAMES) VALUES (' ',' ', 'C', 'N', 'N', ' '); 

b) You can authorize each requester individually by NOT having a default row. If there is no default row, DB2 requires that the LU be present. If the row isn't found the request is denied. 

INSERT INTO SYSIBM.SYSLUNAMES (LUNAME, SYSMODENAME, USERSECURITY, ENCRYPTPSWDS, MODESELECT, USERNAMES) VALUES ('REMOTELU', ' ', 'A', 'N', 'N', ' '); 

Values that correspond to the example configuration in this document are shown in parenthesis. 

ODBC Resources 
--------------------- 

Data Source Name: DB2MVS 
Comment: This is a connection to DB2 on MVS  

Data Source Value Matching SNA, DB2 and VTAM  
-------------------------------  

Database Server Name DDF Location Name (STARDB) 
SQL Catalog Qualifier SYSIBM or SYSIBM.AUTHID 
SQL Package Collection STARCOLL 

 

  
Network: 

Local LU LU Alias for APPCLLU in SNA Server  

(STARLU) 

Remote LU LU Alias for APPCRLU in SNA Server (LUDB2T) 

Mode SNA Server Mode for LU Partners (LU62STAR) 
 

 

 
  
Data Source Configuration 

DB2 Authorization Requirements 

An SQL package is an object that StarSQL uses to store internal control structures as a compiled form of SQL. You must have an SQL package on the host to use dynamic or static SQL on a DRDA connection. Note that beginning with StarSQL Pro v2.1, StarSQL assumes that required SQL packages already exist on the server. If StarSQL does not find the package it needs already residing on the server, it automatically binds the package "on the fly." A user connecting for the first time with StarSQL must have the following authorizations: 

BINDADD 

CREATE IN <COLLECTION> 

For the example in this document a DB2 Administrator would issue the following DB2 commands: 

GRANT BINDADD TO MYAUTHID 
GRANT CREATE IN COLLECTION STARCOLL TO MYAUTHID 

After the StarSQL Pro packages have been created, the DB2 Administrator can revoke the 'BINDADD' and 'CREATE IN' authorizations from the USER. 
  
StarSQL FAQ 

How are the packages created? 

Many off-the-shelf ODBC applications will execute the ODBC APIs necessary (SQLStatistics & SQLExecDirect) for StarSQL Pro to automatically bind the packages. The packages cannot be bound manually i.e. the StarSQL Pro driver binds the packages using DRDA commands. In general, the packages will be created during normal database processing by the application. StarSQL Pro will bind two packages initially - a Catalog package and a Dynamic package. StarSQL will bind a different Dynamic package depending on the Advanced Options used in the data source (see below). 

StarQuest has a bind utility call 'StarBind' which is included on the StarSQL Pro CDRom for versions 2.40 and later. This application will bind all packages on the database without having to change Advanced Options to bind a new package. 

** HELDCURSORS - StarQuest recommends using the HeldCursors Advanced Option for DB2/MVS users who may experience locking problems on the database. 

What are the names of the packages that are created? 

Static packages created correspond to Advanced Option settings for Isolation Level and Held Cursors option.  

Catalog package (SYSIBM) 
SWRC0000 - read committed/held cursors off (default) 
SWRR0000 - repeatable read/held cursors off 
SWRU0000 - read uncommitted/held cursors off 
SWTS0000 - serializable/held cursors off 
SWRC1000 - read committed/held cursors on 
SWRR1000 - repeatable read/held cursors on 
SWRU1000 - read uncommitted/held cursors on 
SWTS1000 - serializable/held cursors on 

What happens after package binding? 

After the packages are created, the DB2 Administrator must 'GRANT EXECUTE' to all users of StarSQL Pro. For this example the following command would be issued: 

GRANT EXECUTE ON STARCOLL.SYSIBM TO AUTHID 
GRANT EXECUTE ON STARCOLL.SWRC0000 TO AUTHID 
etc. 

Each user of StarSQL should specify 'STARCOLL' as the SQL Package Collection in the StarSQL Data source and all users will share the packages that were created in the initial connection. 

APPENDIX 3: IMPORTING DB2 DATA INTO EXCEL 

 

 
 

 
Pull down menu. 

 
Select database. 
 

 
Enter UserID/Password RACF, ACF2, UNIX, OS/400 etc. 
 

 
 
Secect authorized tables and views. 
 

 
Select columns. 
 

 
 
 

 

 

 

  

 
APPENDIX 4: SAMPLE HTML AND ACTIVE SERVER PAGE 
  
  
Sample HTML 

This is for the a sample htm file that has calls the ASP files 

<HTML> 
<HEAD> 
<TITLE>TEST Active Server Pages</TITLE> 
</HEAD> 
<BODY BGCOLOR=#FFFFFF> 
<TABLE> 
</TR> 
</TABLE> 
<HR> 
<P> 
<A HREF="SOURCE2.asp">Show me a list of our products (DB2MVS) </A> 
</BODY> 
</HTML> 

Sample ASP 

<%@ LANGUAGE=VBSCRIPT %> 

<HTML> 
<HEAD> 
<TITLE>ADO Enabled Application that display results from Nell via TCP/IP</TITLE> 
</HEAD> 
<BODY BGCOLOR=#ffffff> 

<% 
Set cnnODBC = Server.CreateObject("ADODB.Connection") 
cnnODBC.Open "DB2MVS", "USERID", "PASSWORD
Set rstODBC = cnnODBC.Execute("SELECT * from STARTRAK.PRODLIST") 
%> 

<P>The query is SELECT * from STARTRAK.PRODLIST</P> 
<P>Here are the results from the query.</P> 

<BR><I><B><%=sql%></I></B><P> 
<TABLE BORDER=1> 
<TR> 
<% For i = 0 to rstODBC.Fields.Count - 1 %> 
<TD><B> 
<%= rstODBC(i).Name %> 
</B></TD> 
<% Next %> 
</TR> 

<% 
v=rstODBC.GetRows 
rstODBC.close 
cnnODBC.close 
%> 
<P> 
<% For row = 0 to UBound(v,2) %> 
<TR> 
<% For col = 0 to UBound(v,1) %> 
<TD><%= v(col,row) %></TD> 
<% Next %> 
</TR> 
<% Next %> 
<BR> 

</BODY> 
</HTML>

 
APPENDIX 5: SAMPLE REPLICATION SUBSCRIPTION 
 
 
Start StarQuest Data Replicator and select source and destination tables. 
 

  
 
Specify source and destination table properties if required. 
  

 
    
  
Subscription Wizard- Choose a table.
 
 
  
Specify optional horizontal selection criteria- for selection of table rows. 
 

 
Select the destination database and request bulk copy or ODBC insertion- bulk copy is faster; ODBC logs database changes. 

 
  
  
Specify vertical selection criteria- for selection of table columns. 

Combine fields and change data types if required. 

  
  
Specify optional "before" and "after" processing-on the source and destination databases.
  

    
  
Schedule the subscription giving time of day and frequency for the transfer. 
  

   
Run the replication and review replication statistics in detail. 

 
APPENDIX 6: SAMPLE MTS CONFIGURATION  

Connection pooling is very useful when an ODBC application like Microsoft Internet Information Server (for example) connects and disconnects frequently. Microsoft Internet Information server (IIS) version 3.0 with Active Server Pages (ASP) takes advantage of connection pooling. You can enable connection pooling for IIS users by changing the value of StartConnectionPool to 1. The StartConnecti under: 

HKEY_LOCAL_MACHINE\System\  
CurrentControlSet\Services\W3SVC\ASP\Parameters. 

 
An ODBC application can use SQLSetEnvAttr to enable connection pooling. The following is an example of how to enable connection pooling in an ODBC application:  
#include <windows.h> 
#include <stdio.h> 
#include <sql.h> 
#include <sqlext.h> 

void main() 
{ 
SQLHENV henv; 
SQLHDBC hdbc; 
int i=0; 

if (!SQL_SUCCEEDED(SQLSetEnvAttr( 
NULL, // make process level cursor pooling 
SQL_ATTR_CONNECTION_POOLING, 
(SQLPOINTER)SQL_CP_ONE_PER_DRIVER, 
SQL_IS_INTEGER))) 
printf("SQLSetEnvAttr/SQL_ATTR_CONNECTION_POOLING error\n"); 

if (!SQL_SUCCEEDED(SQLAllocHandle(SQL_HANDLE_ENV, NULL, &henv))) 
printf("SQLAllocHandle error\n"); 

// set the ODBC behavior version. 
if (!SQL_SUCCEEDED(SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, 
(SQLPOINTER) SQL_OV_ODBC2, SQL_IS_INTEGER))) 
printf("SQLSetEnvAttr/SQL_ATTR_ODBC_VERSION error\n"); 

//set the matching condition for using an existing connection in the 
pool 
if (!SQL_SUCCEEDED(SQLSetEnvAttr(henv, SQL_ATTR_CP_MATCH, 
(SQLPOINTER) SQL_CP_RELAXED_MATCH, SQL_IS_INTEGER))) 
printf("SQLSetEnvAttr/SQL_ATTR_CP_MATCH error\n"); 

 while (i < 10) {  

if (!SQL_SUCCEEDED(SQLAllocHandle(SQL_HANDLE_DBC, 
henv, &hdbc))) 
printf("SQLAllocHandle error\n"); 
if (!SQL_SUCCEEDED(SQLConnect(hdbc, 
(unsigned char*)"testing\0", SQL_NTS, 
(unsigned char*)"sa\0", SQL_NTS, 
(unsigned char*)"\0", SQL_NTS))) 
printf("SQLConnect error\n"); 
else 
printf("Connect successfully %d times\n", i); 
//the first time, the application calls SQLDisconenct, it will return 
//the connection to the //pool 
SQLDisconnect(hdbc); 

 
if (!SQL_SUCCEEDED(SQLFreeHandle(SQL_HANDLE_DBC, hdbc))) 
printf("SQLFreeHandle error\n"); 
i++; 
} 
SQLFreeHandle(SQL_HANDLE_ENV, henv); 
\}   

When the ODBC application calls SQLDisconnect the first time, the connection is saved to the pool. Any subsequent SQLConnect/SQLDisconnect that matches the required condition will reuse the first connection. 

Back to the top

Back to the White Papers Summary

To find out more about StarQuest products,
fill out this information request form or e-mail to sales@starquest.com.

Products | White Papers | Customer Support | Partners | About StarQuest | Press & Events

Copyright 2000 StarQuest Software, Inc. Please read our legal notice.
Contact webmaster@starquest.com with site comments.