README file for C++ Samples DB2 Universal Database for SILICON GRAPHICS IRIX ================================================ Last update : November 1999. The following is a table of sample programs that are supplied with DB2. 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, 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 .--------------------------------------------. .--|How to build the SAMPLE programs using make |-----------------------------. | '--------------------------------------------' | | Before building the sample programs, you require: | | | | - Acces to a remote DB2 server where a SAMPLE database resides. | | - UID and password for the remote server assigned to the | | UID and PWD environment variables in the supplied | | sample makefile. | | | | 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 | | ---------------+------+-------------------------------------------------- "autocfg.sqC" | |Demonstrates the use of the following APIs: | | Autoconfig | | Autoconfig Free Memory | | Update Database Configuration | | Update Database Manager Configuration | | Set Client | | SQLCA Message ---------------+------+-------------------------------------------------- "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. ---------------+------+-------------------------------------------------- "spclient.sqC" | |Client program for the stored procedure program | |"spserver" (which is only available on DB2 servers). ---------------+------+-------------------------------------------------- "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. ---------------+------+-------------------------------------------------- "updat.sqC" | |Uses static SQL to update a database. ---------------+------+-------------------------------------------------- "utilapi.C" | |Error checking utility for non-embedded SQL DB2 | |API prgrams. ---------------+------+-------------------------------------------------- "utilapi.h" | |Header file for "utilapi.c". ---------------+------+-------------------------------------------------- "utilemb.h" | |Header file for "utilemb.sqC". ---------------+------+-------------------------------------------------- "utilemb.sqC" | |Error checking utility for embedded SQL programs. ---------------+------+-------------------------------------------------- ---------------+------+--------------------------------------------------- BUILD |NOTES | DESCRIPTION FILE | | NAME | | ---------------+------+--------------------------------------------------- "bldapp" | |Builds a C++ application program. ---------------+------+--------------------------------------------------- "bldmt" | |Builds a C++ multi-threaded embedded SQL program. ---------------+------+--------------------------------------------------- "embprep" | |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. ---------------+------+--------------------------------------------------- ---------------+------+--------------------------------------------------- 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). ---------------+------+---------------------------------------------------