Importing Stored Procedures

CONNX automatically imports stored procedures during the CONNX table/view import process. In the example below, three stored procedures defined on a DB2 UDB 6.1 for Windows target machine appear as tables in the CONNX Import Table Selection dialog box.

DB2ADMIN.JSERVER and DB2ADMIN.MRSPSRV are Java stored procedures, whereas DB2ADMIN.OUTSRV2 is a C++ stored procedure defined in a DLL (dynamic linked library). These example procedures are included in the DB2 UDB 5.x and 6.x SDK (Software Development Kit).

image\impsp02.jpg

CONNX can import stored procedures from any DRDA-compliant target, including DB2 UDB 5.x and 6.x for Windows/Linux, DB2/400, and DB2 for MVS/OS/390. On supported platforms, CONNX can import stored procedures with input, output, and input/output parameters, as well as stored procedures which return multiple result sets. Stored procedures can be implemented in a variety of high-level languages, including Java, C/C++, Cobol, RPG, and DB2/400 Command Language. The CONNX user does not need to know the implementation details. As long as a stored procedure is defined to the target DB2 system metadata catalog via the Create Procedure SQL statement, CONNX can find and import it.

Once imported to the CDD, the DB2 stored procedure properties are displayed in a tabbed dialog format similar to imported tables or views.

 

image\impsp03.jpg

An ODBC application can invoke a DB2 stored procedure via CONNX with the following syntax:

 

?={call rdbname.schema.procname(?,?,...?)}

 

or

 

?={call schema.procname(?,?,...?)}

or

?={call procname(?,?,...?)}

 

where the left question mark (?) is an optional return parameter, and the parameters within parentheses are input/output parameters defined by the ODBC 2.x/3.x SQLBindParameter API calls. DB2 stored procedure result set attributes are not imported; these attributes are determined at run time.

For more information on procedure calls, see Chapter 8, SQL Statements, in Volume 1 of the Microsoft ODBC 3.0 Programmer's Reference and SDK Guide, published by Microsoft Press, Redmond, Washington, 1997, ISBN 1-57231-516-4.

 

Related Topics

image\CHICLET.jpg Import and Connect-Time Security Requirements

image\CHICLET.jpg How the CONNX DB2 Module Maps ODBC to DRDA Isolation Levels