**********************************************************************
*
* README file for CLI Samples
* DB2 Universal Database Version 6.1
* SDK for Windows NT, Windows 95, and Windows 98
*
* Last update : April, 1999
*
* These programming examples are for the "C" programming language, and
* can be found in the "sqllib\samples\cli" directory. Copy these files
* to your working directory prior to building the sample programs.
*
* WARNING: Some of these samples will change your database manager
* configuration. Execute the samples in a test instance only.
*
* Samples Run on Server:
* Some of the samples supplied will not run on the DB2 for Windows 95
* platform as DB2 for Windows 95 is a client-only platform and these
* samples are stored procedures which run on servers only.
*
* The following files are to be run on the server only:
* - inpsrv2.c - outsrv2.c
* - order.c - showda.c
* - mrspsrv.c - mrspsrv2.sqc
* - udf.c
*
* A number of other samples will not run on the client if the
* above programs are not compiled and accessible on the server.
* See the 'Stored Procedure' section below for a complete list.
*
**********************************************************************
*
* For more information on programming in CLI see the:
* o "Building CLI Applications" section of the Application Building Guide
* o CLI Guide and Reference.
* o the CLI makefile
*
* For more information on the SQL language see the SQL Reference.
*
* For the latest information on programming, compiling, and running DB2
* applications, refer to the DB2 application development website at
* http://www.software.ibm.com/data/db2/udb/ad
*
**********************************************************************
*
* BUILDING THE SAMPLES
*
* The makefile has instructions on setting up your environment to compile
* and run the samples. Please see this file for specific details.
* Before building the sample programs, you require:
*
* - Your environment initialized to a valid db2 instance.
* - The sample database (created with the db2sampl commmand).
* - The database manager started (with the db2start command).
* - Write permission to the the "sqllib\function" directory of
* the database instance prior to building the stored procedures
* - The COMPILER environment variable set properly in the
* makefile for the compiler you want to use (either Microsoft
* Visual C++ or IBM VisualAge C++).
*
* Once you are set up you can run the command 'nmake all' from your
* working directory.
*
**********************************************************************
*
* All samples that require a connection will prompt for:
* server, user name, password.
* Optionally they can be passed on the command line, but many samples
* will prompt for other values.
*
* All objects are created with a qualifier of the current userid.
**********************************************************************
*
* File Descriptions:
*
**********************************************************************
README - this file!
makefile - makefile for all files
cliprep - batch file to precompile and link embedded SQL
**********************************************************************
* Utility files used by most CLI samples
**********************************************************************
samputil.c Utility functions used by most samples
samputil.h Header file for samputil.c, included by most samples
**********************************************************************
* General CLI Samples
**********************************************************************
adhoc.c Interactive SQL with formatted output (was typical.c)
async.c Run a function asynchronously (based on fetch.c)
basiccon.c Basic connection
browser.c List columns, foreign keys, index columns or stats for
a table
colpriv.c List column Privileges
columns.c List all columns for table search string
compnd.c Compound SQL example
datasour.c List all available data sources
descrptr.c Example of descriptor usage
drivrcon.c Rewrite of basiccon.c using SQLDriverConnect
duowcon.c Multiple DUOW Connect type 2, syncpoint 1 (one phase
commit)
embedded.c Show equivalent DB2 CLI calls, for embedded SQL (in
comments)
fetch.c Simple example of a fetch sequence
getattrs.c List some common environment, connection and statement
options/attributes
getcurs.c Show use of SQLGetCursor, and positioned update
getdata.c Rewrite of fetch.c using SQLGetData instead of
SQLBindCol
getfuncs.c List all supported functions
getfuncs.h Header file for getfuncs.c
getinfo.c Use SQLGetInfo to get driver version and other
information
getsqlca.c Rewrite of adhoc.c to use prepare/execute and show
cost estimate
lookres.c Extract string from resume clob using locators
mixed.sqc CLI sample with functions written using embedded SQL
(Note: This file must be precompiled )
multicon.c Multiple connections
native.c Simple example of calling SQLNativeSql, and
SQLNumParams
prepare.c Rewrite of fetch.c, using prepare/execute instead of
execdirect
proccols.c List procedure parameters using SQLProcedureColumns
procs.c List procedures using SQLProcedures
sfetch.c Scrollable cursor example (based on xfetch.c)
setcolat.c Set column attributes (using SQLSetColAttributes)
setcurs.c Rewrite of getcurs.c using SQLSetCurs for positioned
update
seteattr.c Set environment attribute (SQL_ATTR_OUTPUT_NTS)
tables.c List all tables
typeinfo.c Display type information for all types for current
data source
**********************************************************************
* BLOB Samples
**********************************************************************
picin.c Loads graphic BLOBS into the emp_photo table directly
from a file using SQLBindParamToFile
picin2.c Loads graphic BLOBS into the emp_photo table using
SQLPutData
showpic.c Extracts BLOB picture to file (using
SQLBindColToFile), then displays the graphic.
showpic2.c Extracts BLOB picture to file using piecewise output,
then displays the graphic.
**********************************************************************
* Stored Procedure and UDF Samples
**********************************************************************
calludf.c Calls a UDF defined in udf.c
udf.c Defines a number of UDFs which are called by calludf.c
clicall.c Defines a CLI function which is used in the embedded
SQL sample mrspcli3.sqc
inpcli.c Call embedded input stored procedure (samples/c/inpsrv)
inpcli2.c Call CLI input stored procedure inpsrv2.c
inpsrv2.c CLI input stored procedure (rewrite of embedded sample
inpsrv.sqc)
mrspcli.c CLI program that calls mrspsrv.c
mrspcli2.c CLI program that calls mrspsrv2.sqc
mrspcli3.sqc An embedded SQL program that calls mrspsrv2.sqc using
clicall.c
mrspsrv.c Stored procedure that returns a multi-row result set
mrspsrv2.sqc An embedded SQL stored procedure that returns a
multi-row result set (Note: This file must be precompiled )
outcli.c Call embedded output stored procedure samples/c/inpsrv
outcli2.c Call CLI output stored procedure outsrv2.c
outsrv2.c CLI output stored procedure (rewrite of embedded
sample inpsrv.sqc)
sendda.c Call CLI output stored procedure (showda.c)
showda.c Accepts any number of arguments, displays sqlda
information, and modifies the argument values.
**********************************************************************
* Samples using ORDER tables
* Creates tables in any database using create.c
* Uses UDF, UDT, Array In, Array Fetch, Multiple Result Sets
*
* NOTE! Make order.c first, then execute in the following order:
**********************************************************************
create.c Creates all tables for the order scenario
custin.c Inserts customers into the customer table (array
insert)
prodin.c Inserts products into the products table (array
insert)
prodpart.c Inserts parts into the prod_parts table (array insert)
ordin.c Inserts orders into the ord_line, ord_cust tables
(array insert)
ordrep.c Generates order report using multiple result sets,
and the 'price' UDF defined in order.c
partrep.c Generates exploding parts report (recursive SQL Query)
dropcli.c Removes the new tables created for the ORDER scenario
order.c UDF library code (declares a 'price' UDF)
**********************************************************************
* Version 2 Samples unchanged
**********************************************************************
v2fetch.c fetch.c using old v2 functions
v2xfetch.c xfetch.c using old v2 functions
v2sutil.c samputil.c using old v2 functions
v2sutil.h samputil.h using old v2 functions