< Previous | Next >

Creating and connecting to the VIDEOS database

In this exercise, you 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. You will create the database by running a batch file. The batch file and the source files that contain the data for the VIDEOS database tables are included in the createVideos.zip file, which is in the following directory: installdir\plugins\com.ibm.datatools.sqlbuilder_version\samples, where installdir is your installation directory.

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. Click Start > Programs > IBM DB2 > Command Line Tools > Command Window.
  3. In the DB2 command window, change to the createVideoStore directory under the directory that you extracted the files to.
  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
  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, showing you that the database was created successfully.

Connecting to the database

Before you can create an 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. Switch to the Data perspective. If the Data perspective is not open, click Window > Open Perspective > Other, and then double-click 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 then click Next.
  4. On the Select Connection page, with the Create a new connection option selected, click Next. If you had created a connection to the VIDEOS database previously, you could select it on the Select Connection page, and then click Finish. If the connection does not exist, you can create it while you create a database development project.
  5. Specify the database connection information on the Connection Parameters page:
    1. Select a database manager, and then select a JDBC connection.
    2. Type VIDEOS for the database name.
    3. Under User information, type your user ID and password.
    4. Click Next.
  6. On the Specify Schema Filter page, click Finish.
The VideoStoreProject is added in the Data Project Explorer, and a connection to the VIDEOS database is added in the Database Explorer.
< Previous | Next >