Using DB2 in CS 640

1.   Getting your own version of DB2

·         IBM offers DB2 Express-C, which you can download and use. There is also a DB2 Express-C user manual (in a variety of languages) that explains how to set up the software and use it on your own machine.

·         Several Linux installations are explained at http://tldp.org/HOWTO/DB2-HOWTO/

Installing DB2 Express-C version 9.7 on Ubuntu

I. Installation Steps:

1.      Download DB2 Express-C

2.      Extract the db2exc_971_LNX_x86.tar.gz, or the equivalent downloaded version

3.      Go to terminal, navigate to the extraction directory

Note: There are some limitations for installing DB2 as non-root user. So, it is better to switch to root user (using "su root" command) first before installing DB2

4.      run ./db2setup

Note: If you get any missing libraries errors, do not run ./db2setup -f sysreq to force installation; get those libraries installed first (you can use synaptic package manager on Ubuntu to get those libraries)

5.      After running db2setup, an installation wizard should appear

6.      Go to install a product (from the left menu)

7.      Press "Install New". This should install DB2 Express-C Version 9.7

8.      Another wizard will pop up, follow its instructions

9.      Click next, accept license agreement

10.  Select "custom installation"

®New installation

® Select ALL features (to include the Application Development tools)

11.  DAS User Information:

Enter you username and password.. You can select an existing user with the same user id as the Ubuntu account

12.  Select "create Db2 Instance"

13.  Set owner user for that instance (You will not be allowed to select the same user as the DAS; so create a new user)

Note: This is the account that you will use to run DB2

14.  Set fencing users for that instance. You can leave it to the default entries, just write a password

15.  Click next

16.  Select-> "Do not prepare the DB2 tools catalog", we do not need the (Task Center and scheduler) now

17.  Select-> "Do not set up your Db2 server to send notifications at this time"

18.  Summary->Finish

19.  Give it some time

If you get this error:

"Configuring the DB2 Administration Server :.......Success

Updating global profile registry :.......Success

WARNING: A minor error occurred while installing "DB2 Express-C " on this

computer. Some features may not function correctly."

ignore it

20.  Click finish

Installing DB2 Express-C version 9.7 on Windows

I. Installation Steps:

1.      Download DB2 Express-C

2.      Click on Launch and follow instructions; This unzips the files and starts a Setup wizard.

3.      Go to install a product (from the left menu)

4.      Press "Install New". This should install DB2 Express-C Version 9.7

5.      Another wizard will pop up, follow its instructions

6.      Click next, accept license agreement

7.      Select "typical installation"

8.      DAS User Information:

Enter your username and password.. You can select an existing user with the same user id as the Windows account

9.      After Next and Finish, the installation will begin.

10.  When asked, create the DB2 First Steps profile.

11.  First Steps will launch a browser page.

12.  There are no updates to download.

13.  Click the button to create the sample database.

II. USING DB2

·         Open the DB2 “command window” that should be available from Start ® All Programs ® IBM DB2

·         Then start DB2 by entering the command

db2

DB2 should start, and open the db2 command line

·         Then connect to the sample database

connect to sample

·         To see the list of defined tables and views:

list tables

·         To examine the contents of the table staff:

select * from staff

·         Enter any SQL queries

·         To exit DB2, type

Quit

 

You will likely also wish to review the sample database description.