Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

IBM-Introduction to Database Management-Lecture 22 Slides-Computer Science, Slides of Introduction to Database Management Systems

This course answers three main questions. Why do we use Databases? (Functionality provided by a DBMS. Models of databases: Network, Relational, OO.) How do we use a DBMS? (Relational model, logic-based query languages. SQL and dirty tricks. Embedding of query languages and applications. Relational Algebra and Query execution. Transactions and Recovery.) How do we design databases? Data Modeling: The Entity-Relationship model. Data anomalies and Normal forms. Basic physical design). IBM DB2 at UW

Typology: Slides

2011/2012

Uploaded on 02/12/2012

richiey
richiey 🇨🇦

32 documents

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
IBM DB2 at UW
(a mini-tutorial)
David Toman
School of Computer Science
University of Waterloo
David Toman (University of Waterloo) IBM DB2 at UW 1 / 13
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download IBM-Introduction to Database Management-Lecture 22 Slides-Computer Science and more Slides Introduction to Database Management Systems in PDF only on Docsity!

IBM DB2 at UW

(a mini-tutorial)

David Toman

School of Computer Science University of Waterloo

DB2: what is it?

DB2 is a relational DBMS and a set of tools:

• a command-line interface to SQL

• an ESQL preprocessor for C language

This tutorial covers (briefly):

• How do I run it?

• Useful hints

• What if something goes wrong?

DB2 documentation:

will be available on-line

from the course web page

First Steps (example)

softbase.cs$ rlogin rees Last login: softbase.cs.uwat (pts/58) Sun Jul 27 07:04:22 2008 [...] rees$ source ~db2cs348/sqllib/db2profile rees$ db (c) Copyright IBM Corporation 1993, Command Line Processor for DB2 SDK 7.2.

[...]

For more detailed help, refer to the Online Reference Manual.

db2 =>

Commecting to a Database

db2 => connect to cs

Database Connection Information

Database server = DB2/SUN 7.2. SQL authorization ID = DAVID Local database alias = CS

db2 =>

cs348 is the name of a database managed by DB2 for this class

What tables are there?

db2 => list tables

Table/View Schema Type Creation time


ARTICLE DAVID T 2008-05-08-15.53. AUTHOR DAVID T 2008-05-08-15.53. BOOK DAVID T 2008-05-08-15.53. JOURNAL DAVID T 2008-05-08-15.53. PROCEEDINGS DAVID T 2008-05-08-15.53. PUBLICATION DAVID T 2008-05-08-15.53. WROTE DAVID T 2008-05-08-15.53. 7 record(s) selected.

Is that all?

db2 => list tables for all

Table/View Schema Type Creation time


ARTICLE DAVID T 2008-05-08-15.53. AUTHOR DAVID T 2008-05-08-15.53. COLCHECKS SYSCAT V 1999-09-10-10.55. ... SYSTABLES SYSIBM T 1999-09-10-10.55. ... SYSVIEWS SYSIBM T 1999-09-10-10.55. COLDIST SYSSTAT V 1999-09-10-10.55. COLUMNS SYSSTAT V 1999-09-10-10.55. FUNCTIONS SYSSTAT V 1999-09-10-10.55. INDEXES SYSSTAT V 1999-09-10-10.55. TABLES SYSSTAT V 1999-09-10-10.55.

146 record(s) selected.

More HELP

What do these funny error codes (e.g., DB21034E) mean??

db2 => blah blah DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "blah" was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "". SQLSTATE=

db2 =>? DB21034E

DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned:

Explanation: This message is displayed before the SQL error message. The error may be caused by a syntax error in a non-SQL command.

User Response: Correct the error and resubmit the command.

Command Line Usage

Syntax: db2

rees$ db2 list tables

Table/View Schema Type Creation time


ARTICLE DAVID T 2000-05-08-15.53. AUTHOR DAVID T 2000-05-08-15.53. BOOK DAVID T 2000-05-08-15.53. JOURNAL DAVID T 2000-05-08-15.53. PROCEEDINGS DAVID T 2000-05-08-15.53. PUBLICATION DAVID T 2000-05-08-15.53. WROTE DAVID T 2000-05-08-15.53.

7 record(s) selected.

special characters (e.g., *) have to be quoted

Problems

look if DB2 is running (this is how a healthy DB2 looks like):

rees$ ps -ef | grep db db2cs348 2799 1 0 Jun 14? 0:00 db2jd 50348 db2cs348 2746 2743 0 Jun 14? 0:00 db2sysc db2cs348 2748 2744 0 Jun 14? 0:00 db2sysc db2cs348 18696 2744 0 07:32:05? 0:00 db2sysc db2cs348 2743 2742 0 Jun 14? 0:00 db2sysc db2cs348 2745 2743 0 Jun 14? 0:00 db2sysc db2cs348 2747 2744 0 Jun 14? 0:00 db2sysc db2cs348 18694 2745 0 07:32:03? 0:01 db2sysc db2cs348 18697 2744 0 07:32:05? 0:00 db2sysc db2cs348 18695 2744 0 07:32:05? 0:00 db2sysc db2cs348 18699 2744 0 07:32:05? 0:00 db2sysc db2cs348 18700 2744 0 07:32:05? 0:00 db2sysc db2cs348 18698 2744 0 07:32:05? 0:00 db2sysc david 18693 1 0 07:30:47 pts/58 0:00 db2bp 18529 5

if you can’t access DB2 for contact the TAs of CFCF consultants.