beautypg.com

IBM Data Server DB2 User Manual

Page 264

background image

250

DB2 Deployment Guide

Figure 5-5 Overview of the Java application

: The main class in the application is the M

igrateMainController

. The first

action is to retrieve the current database configuration. This is done by
issuing a set of queries against the DB2 metadata in ITSODB. In the figure
only the

TableInfoQuery

is shown. Other queries are left out to keep the figure

simple. The MigrateMainController has now access to both the new and the
current configuration which is shipped with the controller.

: The C

hangeController

is then initiated taking the two

DatabaseConfiguration classes as input parameters. The ChangeController
compares the two database configurations to determine new tables, tables to
be removed, and tables that have to be changed.

: For tables, we then use

TableChangeController

to create the set of

required DDL and SQL statements to update ITSODB to meet the new
configuration. For each table the set of statements are collected into a

job

,

which are returned back to the MigrateMainController.

: Finally the MigrateMainController uses the M

igrateCommand

to execute all

the jobs against the database. We execute the statements in the same ways
as described in 5.2.3, “Using an application” on page 228.

Within the Java application we use the class

DatabaseConfiguration

to contain the

configuration of a database. This class contains a set of classes that reflect the
DB2 metadata. For instance, we use the

ColumnInfo

class to contain the

ITSODB

1

2

3

4