IBM Books

Application Development Guide


Embedded SQL Samples With No DB2 APIs


Table 31. Embedded SQL Sample programs with No DB2 APIs
Sample Program Name Program Description
adhoc Demonstrates dynamic SQL and the SQLDA structure to process SQL commands interactively. SQL commands are input by the user, and output corresponding to the SQL command is returned. See Example: ADHOC Program for details.

C: adhoc.sqc

advsql Demonstrates the use of advanced SQL expressions like CASE, CAST, and scalar full selects.

C: advsql.sqc ; COBOL: advsql.sqb

blobfile Demonstrates the manipulation of a Binary Large Object (BLOB), by reading a BLOB value from the sample database and placing it in a file. The contents of this file can be displayed using an external viewer.

C: blobfile.sqc

calludf Demonstrates calling user-defined functions (UDFs) created by the udf program, and stored on the server to accesss tables in the sample database.

C: calludf.sqc ; C++: calludf.sqC

columns Demonstrates the use of a cursor that is processed using dynamic SQL. This program lists all the entries in the system table, SYSIBM.SYSTABLES, under a desired schema name.

C: columns.sqc

cursor Demonstrates the use of a cursor using static SQL. See Example: Cursor Program for details.

C: cursor.sqc ; C++: cursor.sqC ; COBOL: cursor.sqb

delet Demonstrates static SQL to delete items from a database.

C: delet.sqc ; COBOL: delet.sqb

dynamic Demonstrates the use of a cursor using dynamic SQL. See Example: Dynamic SQL Program for details.

C: dynamic.sqc ; COBOL: dynamic.sqb

fillcli 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.

C: fillcli.sqc ; C++: fillcli.sqC

fillsrv 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.

C: fillsrv.sqc ; C++: fillsrv.sqC

inpcli Demonstrates stored procedures using either the SQLDA structure or host variables. 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 shows the invocation of stored procedures using an embedded SQL CALL statement. See How the Example Input-SQLDA Client Application Works for details.

C: inpcli.sqc ; C++: inpcli.sqC ; COBOL: inpcli.sqb

inpsrv 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. See How the Example Input-SQLDA Stored Procedure Works for details.

C: inpsrv.sqc ; C++: inpsrv.sqC ; COBOL: inpsrv.sqb

joinsql Demonstrates using advanced SQL join expressions.

C: joinsql.sqc ; COBOL: joinsql.sqb

largevol Demonstrates parallel query processing in a partitioned environment, and the use of an NFS file system to automate the merging of the result sets. Only available on AIX. See Example: Extracting Large Volume of Data (largevol.c) for details.

C: largevol.sqc

lobeval Demonstrates the use of LOB locators and defers the evaluation of the actual LOB data. See How the Sample LOBEVAL Program Works for details.

C: lobeval.sqc ; COBOL: lobeval.sqb

lobfile Demonstrates the use of LOB file handles. See How the Sample LOBFILE Program Works for details.

C: lobfile.sqc ; COBOL: lobfile.sqb

lobloc Demonstrates the use of LOB locators. See How the Sample LOBLOC Program Works for details.

C: lobloc.sqc ; COBOL: lobloc.sqb

lobval Demonstrates the use of LOBs.

C: lobval.sqc

openftch Demonstrates fetching, updating, and deleting of rows using static SQL. See How the OPENFTCH Program Works for details.

C: openftch.sqc ; COBOL: openftch.sqb

outcli Demonstrates stored procedures using a host variable. This is the client program of a client/server example. (The server program is called outsrv.) This program declares a single OUT variable to hold the value returned from the server program. This program demonstrates the use of the CREATE PROCEDURE statement to register a stored procedure and shows the invocation of stored procedures using an embedded SQL CALL statement. See OUT Client Description for details.

C: outcli.sqc ; C++: outcli.sqC ; COBOL: outcli.sqb

outsrv Demonstrates stored procedures using host variables. This is the server program of a client/server example. (The client program is called outcli.) The program sets the value of the function parameter to the median SALARY of the employees in the STAFF table of the sample database. The server does all the database processing (finding the median). The server program returns the host variable and the SQLCA status to the client program. See OUT Stored Procedure Description for details.

C: outsrv.sqc ; C++: outsrv.sqC ; COBOL: outsrv.sqb

recursql Demonstrates the use of advanced SQL recursive queries.

C: recursql.sqc

sampudf Demonstrates User-Defined Types (UDTs) and User-Defined Functions (UDFs) implemented to modify table entries. All UDFs declared in this program are sourced UDFs.

C: sampudf.sqc

static Demonstrates static SQL to retrieve information. See Example: Static SQL Program for details.

C: static.sqc ; C++: static.sqC ; COBOL: static.sqb

tabsql Demonstrates the use of advanced SQL table expressions.

C: tabsql.sqc ; COBOL: tabsql.sqb

tblcli Demonstrates a call to a table function (client-side) to display weather information for a number of cities.

C: tblcli.sqc

thdsrver Demonstrates the use of POSIX threads APIs for thread creation and management. The program maintains a pool of contexts. A generate_work function is executed from main, and creates dynamic SQL statements that are executed by worker threads. When a context becomes available, a thread is created and dispatched to do the specified work. The work generated consists of statements to delete entries from either the STAFF or EMPLOYEE tables of the sample database. This program is only available on UNIX platforms.

C: thdsrver.sqc ; C++: thdsrver.sqC

trigsql Demonstrates using advanced SQL triggers and constraints.

C: trigsql.sqc ; COBOL: trigsql.sqb

updat Demonstrates static SQL to update a database. See Example: UPDAT Program for details.

C: updat.sqc ; C++: updat.sqC ; COBOL: updat.sqb

varinp Demonstrates variable input to Embedded Dynamic SQL statement calls using parameter markers. See How the VARINP Program Works for details.

C: varinp.sqc ; COBOL: varinp.sqb


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]