Designing a test data structure

When you test an application that accesses Db2 data, you should have Db2 data available for testing. To do this, you can create test tables and views.

About this task

  • Test views of existing tables: If your application does not change a set of Db2 data and the data exists in one or more production-level tables, you might consider using a view of existing tables.
  • Test tables: To create a test table, you need a database and table space. Talk with your DBA to make sure that a database and table spaces are available for your use.

    If the data that you want to change already exists in a table, consider using the LIKE clause of CREATE TABLE. If you want others besides yourself to have ownership of a table for test purposes, you can specify a secondary ID as the owner of the table. You can do this with the SET CURRENT SQLID statement.

If your location has a separate Db2 system for testing, you can create the test tables and views on the test system. This information assumes that you do all testing on a separate system, and that the person who created the test tables and views has an authorization ID of TEST. The table names are TEST.EMP, TEST.PROJ and TEST.DEPT.