Getting Started with DB2


Logging into rack40

Our DB2 server is running on rack40.cs.duke.edu. Use your account on rack40 to login:
ssh rack40.cs.duke.edu -l <user>

If this is your first-time login, type the password you received in email. Then, use the command "password" to change your password.


Setting up environment for DB2

If you are using bash (which is the default shell), type:
  . ~cps216/db2profile
You might want to add the above line into your .bashrc to be executed automatically when a shell starts up.

Otherwise, if you are using csh or tcsh, type:

  source ~cps216/db2cshrc
You might want to add the above line into your .cshrc to be executed automatically when a shell starts up.


Using DB2 command-line processor

Start the DB2 command-line processor by typing the following in shell:
  db2 -t
Remember the "-t" option, which allows you to use semicolon (";") to terminate SQL commands.

When you are inside the command-line processor, you will get a prompt that looks like the following:

  db2 =>

To connect to our database, type:

  connect to cps216;

You can now use any SQL commands (CREATE, DROP, SELECT, INSERT, DELETE) to manipulate the database. Another useful DB2 command is "list tables;", which prints out a list of all tables and views you have created.

When you are done, type the following to disconnect from our database:

  disconnect from cps216;

Finally, exit the DB2 command-line processor by typing:

  quit;


Reporting DB2-related problems

Send email to all DB2 DBA's, including Dazhi (wangdz@cs.duke.edu) and Jun (junyang@cs.duke.edu).