Setting up DB2

These instructions assume that you are using DB2 Universal Database and guide you through the following tasks:

Note. When you create and access the DATAWAREHOUSE table, be aware of the following issues:

Complete the following steps:

  1. Open a new document in a text editor, copy and paste the following script, which creates the USERDB database and runs the BIND utility, into the document, name the file datawarehouse1.sql and save the file.
  2. In a DB2 command window, enter the following command to ensure that DB2 is started:
    db2start
  3. In a DB2 command window, navigate to the folder that contains datawarehouse1.sql and enter the following command:
    db2 -vf datawarehouse1.sql
  4. Open a new document in a text editor, copy and paste the following script, which creates the DATAWAREHOUSE table into a text editor, into the document, name the file datawarehouse2.sql and save the file.
    CONNECT TO USERDB
    DROP TABLE DATAWAREHOUSE
    CREATE TABLE DATAWAREHOUSE ( MESSAGEDATA BLOB  (1 M )  NOT NULL , PUTTIMESTAMP TIMESTAMP  NOT NULL , DBINSERTTIMESTAMP TIMESTAMP  NOT NULL  WITH DEFAULT CURRENT_TIMESTAMP )
    TERMINATE
          
  5. In a DB2 command window, navigate to the folder that contains datawarehouse2.sql and enter the following command:
    db2 -vf datawarehouse2.sql

    Wait for the script to finish running. If you are running the script for the first time, the following message is displayed, where DB2ADMIN is your user name:

    DB21034E The command was processed as an SQL statement because it was not a valid Command Line 
          Processor command. During SQL processing it returned: 
          SQL0204N "DB2ADMIN.DATAWAREHOUSE" is an undefined name. SQLSTATE=42704
    Ignore this message. The message is displayed because the script attempts to remove an existing table called DATAWAREHOUSE before it creates a new table, but if you have not run the script before, the script cannot find the existing table.
  6. Create an ODBC definition for the USERDB database with USERDB as the data source name (DSN).

    For instructions, see Enabling ODBC connections to the databases in the WebSphere Message Broker documentation.

Back to Setting up the database

Back to sample home