Rational Developer for System z


< Previous | Next >

Creating and connecting to the VIDEOS database

In this exercise, you will create the VIDEOS database, create a data development project, and connect to the database.

Creating the VIDEOS database

The exercises in this tutorial use tables in the VIDEOS database, which you will create by running a batch file. The batch file and the source files that contain the data for the VIDEOS database tables are included increateVideos.zip, which is in the samples folder of the following JAR file: <installation_directory>\rdz\samples\DB2\SQLQueryTutorial, where <installation_directory> is the directory where Rational® Developer for System z® was installed.
Linux The scripts to create the VIDEOS database for this tutorial are not currently provided for the Linux operating system. You can create your own database and follow along with most of the steps in the exercises, adjusting them as necessary for your database and statements.

To create the VIDEOS database:

  1. Open the createVideos.zip file, and extract the files to a new directory.
  2. Open a DB2 command window. In Windows, select from the Start Menu Start > Programs > IBM DB2 > Command Line Tools > Command Window.
  3. In the DB2 command window, change directories to the createVideos\createVideoStore directory.
  4. Enter the following command: createVideoStore.bat. After messages are displayed that show progress in creating the database, the following message is displayed:
       DB200001  The SQL command completed successfully
    Tip: If you do not get a completed successfully message, check to make sure that DB2 is started on your workstation. In Windows, if the DB2 icon in the notification area has a little red square on it,
    then you need to start the Database Manager. Right click on the icon, select Start (DB2), and repeat step 4. You should now get a completion successful message.
  5. To test the creation of the VIDEOS database, enter the following commands in the DB2 command window:
       db2 connect to videos
       db2 select * from xmltest.rentals
The values in the xmltest.rentals table (which is part of the VIDEOS database) are listed and displayed in table format.

Connecting to the database

Before you can create a DB2 SQL query, you must create a data development project and a connection to the VIDEOS database.

To create a project and connect to the database:

  1. In Rational Developer for System z, open the Data perspective by selecting Window > Open Perspective > Other and double-clicking Data in the Open Perspective window.
  2. Click File > New > Data Development Project. The New Data Development Project wizard opens.
  3. On the Data Development Project page of the wizard, type VideoStoreProject for the project name, and click Next.
  4. If you created a connection profile for the VIDEOS database previously, skip to step 7. If the connection profile does not exist, you can create it while you create the data development project.
  5. On the Select Connection page under Connections, click New. The New Connection wizard opens.
  6. Specify the information for the database connection profile in the New Connection wizard.
    1. Under Local on the Connection Parameters page, select DB2 for Linux, UNIX, and Windows.
    2. Under Connection identification, clear the Use default naming convention check box. Then, type VIDEOS Connection for the connection name.
    3. In the Database field, type VIDEOS.
    4. Specify your host and port number.
    5. Type your user ID and password.
    6. Click Finish. The New Connection wizard closes.
  7. On the Select Connection page, select VIDEOS Connection, and click Finish.
VideoStoreProject is added in the Data Project Explorer, and VIDEOS Connection is added under the Database Connections node in the Data Source Explorer.
< Previous | Next >

Feedback