Creating the SAMPLE Database on LUW


The SAMPLE database provided with DB2 on LUW can be created by using one of two methods:

  • Create the database from the First Steps dialog, which launches automatically after installation.

  • Create the database from the command line.

The default schema used for tables in the database will be the user ID you used to log in to the operating system (on Windows, this will be the user ID used to install DB2, and on UNIX, the instance user ID).

You can also create the SAMPLE database from the command line. Included with DB2 is a program called db2sampl that will create and populate the database for you. This program can be found in the bin subdirectory of the directory where db2 was installed. For the purpose of running the examples presented in this book, foreign key constraints are required. The db2sampl program can be executed with an option to also create the primary keys, such as this:

 db2sampl -k 

For reference, Figure F.2 shows the DDL for the SAMPLE database. You can use this DDL to create the tables for the SAMPLE database; however, they will not contain any data. Running the db2sampl program will also populate the tables with sample data.

In addition to the SAMPLE database tables, you still need to create a few other tables to ensure that you can run every example shown in this publication. Figure F.3 provides the DDL for the additional tables. You should create these tables using the same schema used to create the SAMPLE database tables.



    DB2 SQL PL. Deployment and Advanced Configuration Essential Guide for DB2 UDB on Linux., UNIX, Windows, i5. OS, z. OS
    Intelligent Enterprises of the 21st Century
    ISBN: N/A
    EAN: 2147483647
    Year: 2003
    Pages: 205

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net