beautypg.com

Java sample application: automating update – IBM Data Server DB2 User Manual

Page 261

background image

Chapter 5. Deploying pre-configured databases

247

Table 5-4 DB2 metadata for some of the database objects

Database object dependencies?

Table 5-5 lists where to find information about some of the most import
dependencies for a table.

Table 5-5 Where to find the dependent objects for a table

Use this road map to the system catalog views for further information:

http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.sql.
ref.doc/doc/r0011297.html

Java sample application: Automating update

In this section we provide a Java application that can determine the difference
between two database configurations, generate the required DDL and SQL
statements for altering a table, and finally execute the statements. We look at the
same scenario as shown in Figure 5-4 on page 245, that is, we have some
changes in the

itso.staff

table in our sample database. The application is intended

to be used on the target system with no access to the source system at runtime.
Therefore, the application is shipped with the configuration of the source
database. Once started, the application connects to the target database and
retrieves the configuration by querying the DB2 metadata.

Database object

DB2 metadata

Tables

sysibm.systables, syscat.tables

Columns

sysibm.syscolumns, syscat.columns

Views

sysibm.sysviews, syscat.views

Stored procedures

sysibm.procedures, syscat.procedures

Functions

syscat.functions, syscat.functions

Check constraints

syscat.checks

Triggers

sysibm.systriggers

Indexes

syscat.indexes, syscat.indexes

Database object

DB2 metadata

Views

syscat.tabdep

Stored procedures

syscat.routines, syscat.routinedep, syscat.packagedep

Functions

syscat.routines, syscat.routinedep