DB2 Universal Database Version 6.1 SDK for AIX README file ========================================================== Last update : April, 1999. The following is a table of sample programs that are supplied with the SDK. These programming examples are for the "C++" programming language, and can be found in the "sqllib/samples/cpp" 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. For more information on programming in C and C++, refer to the: - "Programming in C and C++" section of the Application Development Guide. For more information on building C++ applications, refer to the: - "Building C++ Applications" section of the Application Building Guide. For more information on the SQL language, refer to 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 .--------------------------------------------. .--|How to build the SAMPLE programs using make |-----------------------------. | '--------------------------------------------' | | 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 must be started (with the db2start command). | | - Write permission to the the "sqllib/function" directory of | | the database instance prior to building the following programs: | | | | outsrv | | inpsrv | | udf | | fillsrv | | | | Using the makefile in this directory, you can build any of the supplied | | sample programs in one step by entering the following command: | | | | make <prog_name> (eg. make client) | | | | You can also use the makefile to build all the supplied sample programs | | in one step by entering the following command: | | | | make all | | | | To remove the intermediate files, enter: | | | | make clean | | | | To remove all intermediate files and the resulting executables, enter: | | | | make cleanall | | | | Although the makefile is easier to use, it may be more difficult to | | understand, so script files are also included, as described below. | '-----------------------------------------------------------------------------' .----------------------------------------------. .--|How to build the SAMPLE programs using SCRIPTs|---------------------------. | '----------------------------------------------' | | To compile the following programs, you need to invoke the proper build | | scripts. The supplied scripts are listed near the end of this README file. | | For detailed information on these scripts, and for additional setup | | information, refer to the "Application Building Guide". | '-----------------------------------------------------------------------------' Table Legend: ============= NOTES: CLI A client application, which calls a stored procedure or declares and calls a user-defined function on the server. SRV You must run this sample locally on the server. STP A stored procedure, which must be stored on the server, and must be called by a corresponding client application. UDF A library of user-defined functions. The library must be stored on the server, and the functions are declared and called by a corresponding client application. ---------------+------+--------------------------------------------------- SAMPLE |NOTES | PROGRAM DESCRIPTION PROGRAM | | NAME | | ---------------+------+-------------------------------------------------- "calludf.sqC" | CLI |Uses the library of User-defined Functions (UDF) | |created by "udf" for the SAMPLE database tables. ---------------+------+-------------------------------------------------- "client.C" | |Demonstrates the use of the following APIs: | | SET CLIENT | | QUERY CLIENT ---------------+------+-------------------------------------------------- "cursor.sqC" | |Demonstrates the use of a "CURSOR" using static | |SQL. ---------------+------+--------------------------------------------------- "fillcli.sqC" | CLI |Demonstrates the client-side of a stored procedure | |that uses the SQLDA to pass information | |specifying which table the stored procedure | |populates with random data. ---------------+------+--------------------------------------------------- "fillsrv.sqC" | STP |Demonstrates the server-side of a stored procedure | |example that uses the SQLDA to receive information | |from the client specifying the table that the | |stored procedure populates with random data. ---------------+------+-------------------------------------------------- "inpcli.sqC" | CLI |Demonstrates stored procedures using the SQLDA | |structure. This is the client program of a | |client/server example. (The server program is | |called "inpsrv".) The program fills the SQLDA | |with information, and passes it to the server | |program for further processing. The SQLCA status | |is returned to the client program. This program | |calls a stored procedure using an embedded | |SQL CALL statement with host variables, alongside | |the old implementation of a DARI API. ---------------+------+-------------------------------------------------- "inpsrv.sqC" | STP |Demonstrates stored procedures using the SQLDA | |structure. This is the server program of a | |client/server example. (The client program is | |called "inpcli".) The program creates a table | |("PRESIDENTS") in the "SAMPLE" database with the | |information received in the SQLDA. The server | |program does all the database processing and | |returns the SQLCA status to the client program. ---------------+------+-------------------------------------------------- "outcli.sqC" | CLI |Demonstrates stored procedures using the SQLDA | |structure. This is the client program of a | |client/server example. (The server program is | |called "outsrv".) This program allocates and | |initializes a one variable SQLDA, and passes it | |to the server program for further processing. | |The filled SQLDA is returned to the client | |program along with the SQLCA status. This | |program calls a stored procedure using an embedded | |SQL CALL statement with host variables, alongside | |the old implementation of a DARI API. ---------------+------+-------------------------------------------------- "outsrv.sqC" | STP |Demonstrates stored procedures using the SQLDA | |structure. This is the server program of a | |client/server example. (The client program is | |called "outcli".) The program fills the SQLDA | |with the median "SALARY" of the employees in the | |"STAFF" table of the "SAMPLE" database. The | |server program does all the database processing | |(finding the median). The server program returns | |the filled SQLDA and the SQLCA status to the | |client program. ---------------+------+-------------------------------------------------- "static.sqC" | |Uses static SQL to retrieve information. ---------------+------+-------------------------------------------------- "thdsrver.sqC" | |Maintains a pool of contexts. A generate_work | |function creates dynamic sql statements that | |are executed by worker threads. ---------------+------+-------------------------------------------------- "udf.c" | UDF |Creates a library of User-defined Functions (UDF) | |made specifically for the SAMPLE database tables, | |but can be used with tables of compatible column | |types. ---------------+------+-------------------------------------------------- "updat.sqC" | |Uses static SQL to update a database. ---------------+------+-------------------------------------------------- "util.C" | |Demonstrates the use of the following APIs: | | GET ERROR MESSAGE | | INSTALL SIGNAL HANDLER | | INTERRUPT | |This program also contains code to output | |information from an SQLDA. ---------------+------+-------------------------------------------------- ---------------+------+--------------------------------------------------- SHELL |NOTES | DESCRIPTION SCRIPT | | NAME | | ---------------+------+--------------------------------------------------- "bldcset" | |Builds a sample C++ embedded SQL program. ---------------+------+--------------------------------------------------- "bldcsetapi" | |Builds a sample C++ program that contains DB2 APIs. ---------------+------+--------------------------------------------------- "bldxlCmt" | |Builds an embedded SQL multi-threaded program. ---------------+------+--------------------------------------------------- "bldcsetsrv" | |Builds a sample C++ stored procedure into a | |shared library, and stores it on the server. ---------------+------+--------------------------------------------------- "bldxlCudf" | |Builds a sample C++ UDF library and stores it on | |the sever. ---------------+------+--------------------------------------------------- "embprepp" | |Precompiles and binds a C++ sample program that | |contains embedded SQL. ---------------+------+--------------------------------------------------- ---------------+------+--------------------------------------------------- CONFIGURATION |NOTES | DESCRIPTION FILES for | | Visual Age C++| | Version 4.0 | | ---------------+------+--------------------------------------------------- "api.icc" | |DB2 API configuration file. ---------------+------+--------------------------------------------------- "emb.icc" | |Embedded SQL configuration file. ---------------+------+--------------------------------------------------- "stp.icc" | |Embedded SQL stored procedure configuration file. ---------------+------+--------------------------------------------------- "udf.icc" | |User-defined function configuration file. ---------------+------+--------------------------------------------------- ---------------+------+--------------------------------------------------- OTHER |NOTES | DESCRIPTION ---------------+------+--------------------------------------------------- "makefile" | |Builds most of the supplied programming examples in | |the "sqllib/samples/cpp" subdirectory. ---------------+------+--------------------------------------------------- "README" | |Lists and describes at a high-level, all files in | |the "sqllib/samples/cpp" subdirectory. (This file). ---------------+------+---------------------------------------------------