IBM Books

API Reference


DB2 Sample Programs

The following table lists the APIs grouped by sample program:

Table 2. DB2 APIs by Sample Program
Sample Code Included APIs
backrest
sqlbstsc - Set Tablespace Containers
sqlubkp - Backup Database
sqluroll - Rollforward Database
sqlurst - Restore Database

checkerr
sqlaintp - Get Error Message
sqleintr - Interrupt
sqleisig - Install Signal Handler
sqlogstt - Get SQLSTATE Message

client
sqleqryc - Query Client
sqlesetc - Set Client

d_dbconf
sqlfddb - Get Database Configuration Defaults

d_dbmcon
sqlfdsys - Get Database Manager Configuration Defaults

dbauth
sqluadau - Get Authorizations

dbcat
sqlecadb - Catalog Database
sqledcls - Close Database Directory Scan
sqledgne - Get Next Database Directory Entry
sqledosd - Open Database Directory Scan
sqleuncd - Uncatalog Database

dbcmt
sqledcgd - Change Database Comment

dbconf
sqlecrea - Create Database
sqledrpd - Drop Database
sqlfrdb - Reset Database Configuration
sqlfudb - Update Database Configuration
sqlfxdb - Get Database Configuration

dbinst
sqleatin - Attach
sqledtin - Detach
sqlegins - Get Instance

dbmconf
sqlfrsys - Reset Database Manager Configuration
sqlfusys - Update Database Manager Configuration
sqlfxsys - Get Database Manager Configuration
sqlgaddr - Get Address

dbsnap
sqlmonss - Get Snapshot

dbstat
sqlureot - Reorganize Table
sqlustat - Runstats

dbstop
sqlefrce - Force Application
sqlepstp - Stop Database Manager

dcscat
sqlegdad - Catalog DCS Database
sqlegdcl - Close DCS Directory Scan
sqlegdel - Uncatalog DCS Database
sqlegdge - Get DCS Directory Entry for Database
sqlegdgt - Get DCS Directory Entries
sqlegdsc - Open DCS Directory Scan

impexp
sqluexpr - Export
sqluimpr - Import

makeapi
sqlabndx - Bind
sqlaprep - Precompile Program
sqlepstp - Stop Database Manager
sqlepstr - Start Database Manager

migrate
sqlemgdb - Migrate Database

monreset
sqlmrset - Reset Monitor

monsz
sqlmonsz - Estimate Size Required for sqlmonss() Output Buffer

nodecat
sqlectnd - Catalog Node
sqlencls - Close Node Directory Scan
sqlengne - Get Next Node Directory Entry
sqlenops - Open Node Directory Scan
sqleuncn - Uncatalog Node
sqlgdref - Dereference Address

qload
sqluqry - Load Query

rebind
sqlarbnd - Rebind

rechist
sqluhcls - Close Recovery History File Scan
sqluhgne - Get Next Recovery History File Entry
sqluhops - Open Recovery History File Scan
sqluhprn - Prune Recovery History File
sqluhupd - Update Recovery History File

regder
sqledreg - Deregister
sqleregs - Register

restart
sqlerstd - Restart Database

setact
sqlesact - Set Accounting String

setrundg
sqlesdeg - Set Runtime Degree

tabscont
sqlbctcq - Close Tablespace Container Query
sqlbftcq - Fetch Tablespace Container Query
sqlbotcq - Open Tablespace Container Query
sqlbtcq - Tablespace Container Query

tabspace
sqlbctsq - Close Tablespace Query
sqlbftpq - Fetch Tablespace Query
sqlbgtss - Get Tablespace Statistics
sqlbmtsq - Tablespace Query
sqlbotsq - Open Tablespace Query
sqlbstpq - Single Tablespace Query
sqlefmem - Free Memory

tload
sqluload - Load

tquiesce
sqluvqdp - Quiesce Tablespaces for Table

tspace
sqlefmem - Free Memory
sqlgmcpy - Copy Memory

util
sqlaintp - Get Error Message
sqleintr - Interrupt
sqleisig - Install Signal Handler
sqlogstt - Get SQLSTATE Message

n/a
sqlcspqy - List DRDA Indoubt Transactions
sqle_activate_db - Activate Database
sqle_deactivate_db - Deactivate Database
sqleaddn - Add Node
sqlecran - Create Database at Node
sqledpan - Drop Database at Node
sqledrpn - Drop Node Verify
sqludrdt - Redistribute Nodegroup
sqlugrpn - Get Row Partitioning Number
sqlugtpi - Get Table Partitioning Information
sqlurlog - Asynchronous Read Log
sqlxphqr - List Indoubt Transactions

Note:a The sample programs can be found in the language specific directory of the samples directory in the sqllib directory (for example, sqllib\samples\c for C source code). The file extensions on sample code depend on the programming language being used. For example, for sample code written in C, the extension is .c or .sqc. Not all programs are available in all supported programming languages. Not all APIs have sample code (indicated by n/a).

How the API Descriptions are Organized

A short description of each API precedes some or all of the following subsections.

Scope

The API's scope of operation within the instance. In a single-node system, the scope is that single node only. In a multi-node system, it is the collection of all logical nodes defined in the node configuration file, db2nodes.cfg).

Authorization

The authority required to successfully call the API.

Required Connection

One of the following: database, instance, none, or establishes a connection. Indicates whether the function requires a database connection, an instance attachment, or no connection to operate successfully. An explicit connection to the database or attachment to the instance may be required before a particular API can be called. APIs that require a database connection or an instance attachment can be executed either locally or remotely. Those that require neither cannot be executed remotely; when called at the client, they affect the client environment only. For information about database connections and instance attachments, see the Administration Guide.

API Include File

The name of the include file that contains the API prototype, and any necessary predefined constants and parameters.

C API Syntax

The C syntax of the API call.

Generic API Syntax

The syntax of the API call for the COBOL and FORTRAN programming languages.

Attention: Provide one extra byte for every character string passed to an API. Failure to do so may cause unexpected errors. This extra byte is modified by the database manager.

API Parameters

A description of each API parameter and its values. Predefined values are listed with the appropriate symbolics. Actual values for symbolics can be obtained from the appropriate language include files. COBOL programmers should substitute a hyphen (-) for the underscore (_) in all symbolics. For more information about parameter data types in each host language, see the sample programs.

REXX API Syntax

The REXX syntax of the API call, where appropriate.

A new interface, SQLDB2, has been added to support calling APIs from REXX. The SQLDB2 interface was created to provide support in REXX for new or previously unsupported APIs that do not have any output other than the SQLCA. Invoking a command through the SQLDB2 interface is syntactically the same as invoking the command through the command line processor (CLP), except that the token call db2 is replaced by CALL SQLDB2. Using the CALL SQLDB2 from REXX has the following advantages over calling the CLP directly:

For more information about the SQLDB2 interface, see the Embedded SQL Programming Guide.

REXX Parameters

A description of each REXX API parameter and its values, where appropriate.

Sample Programs

The location and the names of sample programs illustrating the use of the API in one or more supported languages (C, COBOL, FORTRAN, and REXX).

Usage Notes

Other information.

See Also

A cross-reference to related information.


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

[ DB2 List of Books | Search the DB2 Books ]