The Db2 ODBC shadow catalog
The Db2 ODBC shadow catalog provides increased performance when you need catalog information. To increase the performance of an application that frequently queries the catalog, implement the Db2 ODBC shadow catalog. Redirect catalog functions to the shadow catalog instead of to the native Db2 catalog.
The shadow catalog consists of a set of pseudo-catalog tables that contain rows that represent objects that are defined in the Db2 catalog. These tables are pre-joined and indexed to provide faster catalog access for ODBC applications. Tables in the shadow catalog contain only the columns that are necessary for supporting ODBC operations.
Db2 DataPropagator populates and maintains the Db2 ODBC shadow catalog. Db2 for z/OS® supports the DATA CAPTURE CHANGE clause of the ALTER TABLE SQL statement. This support allows Db2 to mark log records that are associated with any statements that change the Db2 catalog.
Additionally, the Db2 DataPropagator Capture and Apply process identifies and propagates the Db2 catalog changes to the Db2 ODBC shadow, based on marked log records.
[DATASOURCE]
MVSDEFAULTSSID=V61A
CLISCHEMA=CLISCHEM[DATASOURCE]
MVSDEFAULTSSID=V61A
CLISCHEMA=PAYROLL
APPLTRACE=1
APPLTRACEFILENAME="DD:APPLTRC"You can use the CREATE VIEW SQL statement to create views of the Db2 ODBC shadow catalog tables. To use your own set of views, you must create a view for each Db2 ODBC shadow catalog table.
CREATE VIEW PAYROLL.table_name AS
SELECT * FROM PAYROLL.table_name WHERE TABLE_SCHEM='USER01';| Shadow catalog table | Db2 ODBC catalog function |
|---|---|
| CLISCHEM.COLUMNPRIVILEGES | SQLColumnPrivileges() |
| CLISCHEM.COLUMNS | SQLColumns() |
| CLISCHEM.FOREIGNKEYS | SQLForeignKeys() |
| CLISCHEM.PRIMARYKEYS | SQLPrimaryKeys() |
| CLISCHEM.PROCEDURECOLUMNS | SQLProcedureColumns() |
| CLISCHEM.PROCEDURES | SQLProcedures() |
| CLISCHEM.SPECIALCOLUMNS | SQLSpecialColumns() |
| CLISCHEM.TSTATISTICS | SQLStatistics() |
| CLISCHEM.TABLEPRIVILEGES | SQLTablePrivileges() |
| CLISCHEM.TABLE | SQLTables() |
Example: If you specify CLISCHEMA=PAYROLL in the data source section of the Db2 ODBC initialization file, the ODBC catalog functions that normally query the Db2 catalog tables (SYSIBM schema) reference a set of views of the ODBC shadow catalog base tables.
- PAYROLL.COLUMNS
- PAYROLL.TABLES
- PAYROLL.COLUMNPRIVILEGES
- PAYROLL.TABLEPRIVILEGES
- PAYROLL.SPECIALCOLUMNS
- PAYROLL.PRIMARYKEYS
- PAYROLL.FOREIGNKEYS
- PAYROLL.TSTATISTICS
- PAYROLL.PROCEDURES
- PAYROLL.PROCEDURECOLUMNS