Setting up Oracle

These instructions assume that you are using an Oracle database and guide you through the following tasks:

Note. When you create and access the database tables, be aware of the following issues:

Before following these instructions you must have created a database.

Complete the following steps:

  1. Open a new document in a text editor, copy and paste the following script, which creates the tables XMLFLIGHTTB and XMLPASSENGERTB and populates the table XMLFLIGHTTB, into the document, name the file airline2.sql and save the file.

    DROP TABLE XMLFLIGHTTB;
    CREATE TABLE XMLFLIGHTTB (FLIGHTDATE CHAR(8) NOT NULL, FLIGHTNO CHAR(5) NOT NULL, ECONOMICCLASS INTEGER NOT NULL, FIRSTCLASS INTEGER NOT NULL, TOTALECONOMIC INTEGER NOT NULL, TOTALFIRST INTEGER NOT NULL, ECONOMICPRICE INTEGER NOT NULL, FIRSTPRICE INTEGER NOT NULL, STARTPOINT CHAR(20) NOT NULL, ENDPOINT CHAR(20) NOT NULL, RESERVATIONSEQNO INTEGER NOT NULL, CONSTRAINT FLIGHT_UNIQ UNIQUE(FLIGHTDATE, FLIGHTNO));
    INSERT INTO XMLFLIGHTTB VALUES('20030218', 'CA937', 0, 0, 200, 50, 200, 300, 'BEIJING', 'LONDON', 0);
    INSERT INTO XMLFLIGHTTB VALUES('20030525', 'BA039', 0, 0, 180, 40, 220, 320, 'LONDON', 'BEIJING', 0);
    INSERT INTO XMLFLIGHTTB VALUES('20030525', 'CA937', 0, 0, 200, 50, 200, 300, 'BEIJING', 'LONDON', 0);
    INSERT INTO XMLFLIGHTTB VALUES('20030219', 'BA039', 0, 0, 180, 40, 220, 320, 'LONDON', 'BEIJING', 0);
    DROP TABLE XMLPASSENGERTB;
    CREATE TABLE XMLPASSENGERTB (LASTNAME CHAR(20) NOT NULL, FIRSTNAME CHAR(20) NOT NULL, FLIGHTNO CHAR(5) NOT NULL, FLIGHTDATE CHAR(8) NOT NULL, CLASSTYPE CHAR(1) NOT NULL, RESERVATIONNO VARCHAR2(40) NOT NULL, PRIMARY KEY(RESERVATIONNO));
          
  2. Start a command window to access your database, move to the folder that contains airline2.sql and enter the following command:
    sqlplus <uid>/<password> @airline2.sql

    Wait for the script to finish running. If you are running the script for the first time, the following message is displayed:

    ORA-00942: table or view does not exist
    Ignore this message. The message is displayed because the script attempts to remove any existing tables called XMLFLIGHTTB and XMLPASSENGERTB before it creates the new tables, but if you have not run the script before, the script cannot find any existing tables.
  3. Create an ODBC definition for the database with RESERVDB 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