You are on page 1of 22

IBM Software Group

Lesson 3: Tools & Scripting


Part 1 of 2
(DB2 on Campus Lecture Series)

Raul F. Chong
IBM Toronto Laboratory

2005 IBM Corporation

IBM Software Group | DB2 Information Management Software

Agenda
Introduction
Control Center
Command Editor
Command Window / CLP
Task Center
Journal
Health Center
Scripting
2

IBM Software Group | DB2 Information Management Software

Agenda
Introduction
Control Center
Command Editor
Command Window / CLP
Task Center
Journal
Health Center
Scripting
3

IBM Software Group | DB2 Information Management Software


DB2 Commands & SQL/XML,
Xquery Statements

DB2:
The big
Picture

SQL/XML, Xquery
Statements
create bufferpool
create tablespace
create table
alter bufferpool
alter tablespace
alter table
select
insert
update
delete
...
DB2 System Commands
db2set
db2start
db2stop
db2ilist
db2icrt
db2idrop
...
DB2 CLP Commands
db2 update dbm cfg
catalog db
list node directory
create database
list applications
list tablespaces
...
<sql statement>
xquery <
>

DB2 Tools
Command Line Tools
Command Editor
Command Line Processor
Command Window
Development Tools
DB2 Developer Workbench
Project Deployment Tool
General Administration Tools
Control Center
Journal
License Center
Replication Center
Task Center

DB2 Environment

Instance 'myinst'
Database Manager
Configuration
File (dbm cfg)

Database MYDB1
Database
Configuration
File (db cfg)

Information
Information Center
Check for DB2 Updates
Monitoring Tools
Event Analyzer
Health Center
Indoubt Transaction Manager
Memory Visualizer
Activity Monitor

Port

Setup Tools
Configuration Assistant
Configure DB2 .Net Data Provider
Default DB2 Selection Wizard
First Steps
Register Visual Studio Add-ins
4

IBM Software Group | DB2 Information Management Software

DB2 Tools
Start Programs IBM DB2 ...

IBM Software Group | DB2 Information Management Software

Agenda
Introduction
Control Center
Command Editor
Command Window / CLP
Task Center
Journal
Health Center
Scripting
6

IBM Software Group | DB2 Information Management Software

Control Center
The main DB2 administration tool
The Control Center allows you to:
create, modify and manage databases
Manage database objects (tables, indexes, etc.)
Launch the other GUI tools

IBM Software Group | DB2 Information Management Software

Launching Control Center for the First Time


The first time Control Center is launched, you are asked to choose what
view you would like to use
The choice of view determines what types of options and database objects
are exposed

IBM Software Group | DB2 Information Management Software

Launching the Control Center


Navigating through the Windows Start menu
By executing db2cc on a command prompt
By clicking the Control Center icon in the toolbar of any of the other
DB2 GUI tools
From the DB2 icon in the Windows system tray

Right click on the green DB2 icon


and select the DB2 Control Center
menu option

IBM Software Group | DB2 Information Management Software

Control Center

Object Tree
Pane
Object Listing
Pane

Object Details
Pane

10

IBM Software Group | DB2 Information Management Software

Changing to Control Centers Advanced View

Control Center > Tools (menu) > Customize


Control Center > (select) Advanced
11

IBM Software Group | DB2 Information Management Software

Advanced Control Center View

Note the
Additional
Database
Objects

12

IBM Software Group | DB2 Information Management Software

Agenda
Introduction
Control Center
Command Editor
Command Window / CLP
Task Center
Journal
Health Center
Scripting
13

IBM Software Group | DB2 Information Management Software

Command Editor
Using Command Editor, you can execute DB2 commands and SQL, analyze
the execution plan of an SQL statement, and view/update query result sets
You can launch Command Editor several ways:
 As a standalone application

Navigate through the Windows Start Menu

START -> PROGRAMS -> IBM DB2 -> COMMAND LINE TOOLS ->
COMMAND EDITOR

From a command prompt, type db2ce

From the Control Center, click the Command Editor icon on the Control Center
Toolbar

From the Tools menu in Control Center

14

IBM Software Group | DB2 Information Management Software

Command Editor (continued)


Embedded within the Control Center
 Right click on the SAMPLE database icon in the Control Centers Object Tree pane
and select the Query menu item
 Any time a queryable object is selected (database, table, etc.), you can launch the
Command Editor by clicking the Query link in the Control Centers Object Detail pane

Back to Control
Center view

Input area

Command Editor
view selected
Add a database
connection
Database currently
connected to

Output area

Character used to
delimit the end of a
SQL statement or
DB2 command
15

IBM Software Group | DB2 Information Management Software

Command Editor Add (database connection) Dialog


A database connection must exist in order to submit any SQL statements
You can inherit the connection from Control Center (by launching Command
Editor in embedded mode) or by clicking the Add button in Command Editor

Select a database
configured on the system
Check this box to use
the ID and password
of user currently
logged in to the
operating system

Valid OS user ID and


password

16

IBM Software Group | DB2 Information Management Software

Command Editor Commands Tab

Runs the command


(Can also use the
CTRL+Enter shortcut)

Runs the command and


generates an access plan
(more on this later)

Generates an access
plan without running the
command (more on this
later)

17

IBM Software Group | DB2 Information Management Software

The SQL Assist Wizard

SQL Assist Wizard


can also be launched
from the Selected
menu item

18

IBM Software Group | DB2 Information Management Software

SQL Assist Wizard

Sections of the
SQL Query.

The query
constructed so far.

19

IBM Software Group | DB2 Information Management Software

Show SQL Button


Most of the GUI tools/wizards allow you to see the actual command or
SQL statement that is created as a result of using the tool/wizard to
perform an action

This is very handy for:


 Learning SQL syntax
 Saving the statement to a file (or the Windows clipboard) for later use

can be later imported directly into Command Editor

20

IBM Software Group | DB2 Information Management Software

Quicklab #4 Populating the EXPRESS Database


using scripts
In this QuickLab, you will create a simple
installation script for the EXPRESS database and its
objects
Refer to the QuickLab #4 instructions

21

IBM Software Group | DB2 Information Management Software

To be continued
Please see Part 2 of 2 of
this lesson

22

You might also like