IBM Books

Road Map to DB2 Programming


Using DB2 APIs



* Figure crosref not displayed.



API Reference Describes the DB2 application programming interfaces (APIs) and data structures you can use to manage your databases. Explains how to call APIs from your applications.
Administration Getting Started Introduces basic DB2 database administration concepts and tasks, and describes server administration tools.




* Figure programs not displayed.



APIs Demonstrated:
backrest Backup/Recovery:
BACKUP DATABASE
RESTORE DATABASE
ROLL FORWARD DATABASE
d_dbconf Database Configuration:
GET DATABASE CONFIGURATION DEFAULTS
dbcat Node Directory Management:
CATALOG DATABASE
CLOSE DATABASE DIRECTORY SCAN
GET NEXT DATABASE DIRECTORY ENTRY
OPEN DATABASE DIRECTORY SCAN
UNCATALOG DATABASE
dbconf Database Control/Configuration:
CREATE DATABASE
DROP DATABASE
GET DATABASE CONFIGURATION
RESET DATABASE CONFIGURATION
UPDATE DATABASE CONFIGURATION
dbstart Database Manager Control:
START DATABASE MANAGER
dbstop Database Manager Control:
FORCE USERS
STOP DATABASE MANAGER
impexp Data Utilities:
EXPORT
IMPORT
makeapi Application Preparation:
BIND
PRECOMPILE PROGRAM
START DATABASE MANAGER
STOP DATABASE MANAGER
tabspace Table Space Management:
TABLESPACE QUERY
SINGLE TABLESPACE QUERY
OPEN TABLESPACE QUERY
FETCH TABLESPACE QUERY
GET TABLESPACE STATISTICS
CLOSE TABLESPACE QUERY


When writing your applications, you might need to perform some database administration tasks, such as creating, activating, backing up, or restoring a database. DB2 provides numerous APIs so you can perform these tasks from your applications, including embedded SQL and DB2 CLI applications. This enables you to program the same administrative functions into your applications that you can perform using the DB2 server administration tools.

Additionally, you might need to perform specific tasks that can only be performed using the DB2 APIs. For example, you might want to retrieve the text of an error message so your application can display it to the end user. To retrieve the message, you must use the Get Error Message API.

Tasks

The following table lists some of the tasks you can perform using DB2 APIs:
APIs Sample Tasks
Backup/Recovery Back up, restore, roll forward database; open history file scan, prune and update history file
Database Control Activate, create, deactivate, drop, migrate, restart database
Database Manager Control Start and stop database manager
Database Directory Management Catalog and uncatalog database; open and close database directory scan
Node Directory Management Catalog and uncatalog node; open and close node directory scan
Database Configuration Get, reset, and update database configuration
Database Monitoring Get monitor switches; get snapshot
Operational Utilities Force application; quiesce tablespaces for table; reorganize table; run statistics
Data Utilities Export; import; load; load query
General Application Programming Get instance; get error message; dereference address; copy memory; free memory; get address
Application Preparation Precompile program; bind; rebind
Remote Server Utilities Attach; detach
Table Space Management Tablespace query; open, fetch, and close tablespace query; get tablespace statistics
Miscellaneous Get authorizations; query client; initialize and link to device; delete committed session

Merits and Limitations


Merits Limitations
Flexibility: You can use DB2 APIs in both embedded SQL and DB2 CLI applications.

Many programming languages: You can code applications in C, COBOL, FORTRAN, and REXX to call DB2 APIs.

Not easily ported: Applications that use DB2 APIs cannot be ported easily to other database products.


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

[ DB2 List of Books | Search the DB2 Books ]