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 Tools
SQL/XML, Xquery Command Line Tools
DB2: Statements
create bufferpool
Command Editor
Command Line Processor

The big create tablespace


create table
Command Window

Picture alter bufferpool


alter tablespace
Development Tools
DB2 Developer Workbench
DB2 Environment
Instance 'myinst'
alter table Project Deployment Tool
select Database Manager
insert General Administration Tools Configuration
update Control Center File (dbm cfg)
delete Journal
... License Center Database MYDB1
Replication Center Database
DB2 System Commands Task Center Configuration
db2set File (db cfg)
db2start Information
db2stop Information Center
db2ilist Check for DB2 Updates
db2icrt
db2idrop Monitoring Tools
... Event Analyzer Port
DB2 CLP Commands Health Center
db2 update dbm cfg Indoubt Transaction Manager
catalog db Memory Visualizer
list node directory Activity Monitor
create database
list applications Setup Tools
list tablespaces Configuration Assistant
... Configure DB2 .Net Data Provider
<sql statement> Default DB2 Selection Wizard
xquery < > First Steps
Register Visual Studio Add-ins
4
IBM Software Group | DB2 Information Management Software

DB2 Tools
Start Æ Programs Æ IBM DB2 Æ ...

5
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

7
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

8
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

9
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 Center’s 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 Center’s 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 Center’s Object Detail pane

Back to Control Command Editor


Center view view selected

Add a database
connection
Input area
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 Valid OS user ID and
logged in to the password
operating system

16
IBM Software Group | DB2 Information Management Software

Command Editor – Commands Tab

Runs the command Runs the command and Generates an access


(Can also use the generates an access plan plan without running the
CTRL+Enter shortcut) (more on this later) 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