SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
DB2 Universal Database
SSI-Hub Texas A&M
DB2 is a multi-platform scalable, object-relational database server.
This tutorial is for people with little or no experience with DB2.
DB2 GUIS Over-View.
Step by Step approach of how to accomplish some of the most
important database tasks.
Database tasks can be achieved in various ways, in this tutorial, the
focus is on using the GUI tools
Glossary is provided at the end, for the terms used in DB2.

TEXAS A&M-SSI HUB
Key Capabilities and Benefits
Superior scalability
DB2 Universal Database can run on everything from laptops supporting mobile users to
massively parallel systems with terabytes of data and/or thousands of users.
Multimedia extensibility
It allows to extend the capabilities of the database to meet your specific organizational
requirements. This includes the ability to support more advanced applications involving
multimedia data such as documents, images, audio, video, and spatial data.
Complete web-enablement
One of the key new application areas is e-business. DB2 Universal Database is fully integrated
with web technology so that data can be easily accessed from the Internet or from the company
intranet
Universal access
DB2 Universal database can be accessed from almost any client workstation over almost any
network.
Multi-platform support
DB2 Universal database is one of the most open database platforms available. It runs on the most
popular UNIX and Intel server platforms, including AIX, HP-UX, Solaris, Linux, NUMA-Q, OS/2,
and Windows.
http://www-306.ibm.com/software/data/db2/udb/about.html

TEXAS A&M-SSI HUB
IBM DB2 - Menus
After you have installed DB2,these are various options you will see if you go to IBM DB2 in the
main programs. To reach the various GUIS, go to All Programs IBM DB2 Various options.

Command Editor

Development Center
Control Center

Health Center

Configuration Assistant

TEXAS A&M-SSI HUB
The Command Editor
This tool allows the user to input SQL statements or DB2 commands in an interactive window and
see the results.

Type the SQL statements or DB2 commands here.

The result can be seen in this part if the window

TEXAS A&M-SSI HUB
Development Center
Currently for class-projects you wont need to use the Development center as this is the tool that
the administrator uses it to create stored-procedure or UDF (User define function). It is used for
creating objects, the source code is copied on the server and the object is registered in the
catalog table. when a Java object is built, it is complied on the Client application.

TEXAS A&M-SSI HUB
Control Center
This is without a doubt the most important DB2 GUI tool. It provides you with a whole picture of your
instances and databases, and allows the user to perform most database operations in DB2.

T
R
E
E
S
T
R
U
C
T
U
R
E

Detailed information about the item selected. If you select
them you can further modify them.

More Wizard like help for the item selected.

TEXAS A&M-SSI HUB
Health Center
Use the Health Center GUI tool to set up thresholds that, when exceeded, will prompt alert
notifications, or even actions to relieve the situation. In other words, you can have the database
manage itself!

TEXAS A&M-SSI HUB
Configuration Assistant
If a user has DB2 UDB installed on the desktop in College Station, but would like to connect to a
DB2 Server in Germany. How can the user connect to this remote server? The Configuration
Assistant GUI tool can help with the set up and testing of the connection,

The Task Center

TEXAS A&M-SSI HUB
Creating a Database
To create a database there are
various options either one can create
a database from the Command
Centre or the Control Center. The
option from the Control center is easy
as it has a wizard that will guide
through the process.
Here the database creation through
the Control Center is explained.
Click on Databases on the left
panel of the Control Center
Right click on Databases and
choose create -> Standard.
Follow the panels from the
create database wizard.

TEXAS A&M-SSI HUB

Standard
Cont...
The wizard guides through the step by step process of creating the database, it asks for a
database name, location to store the database and the various options about the maintenance of
the data base.

TEXAS A&M-SSI HUB
Creating a Table
From the Control Center again we
would need three steps:
1.

Click on Tables on the left
panel of the Control Center.

2.

Right click on Tables and
choose Create .

3.

Follow the panels from the
create table wizard.

TEXAS A&M-SSI HUB
Cont...
This is how the wizard for creating a table looks like, it will ask for information and the user just fills
in the blanks to create the columns in a table, long with the columns the user can also provide
information about the constraints, keys. Following this same procedure one can create aliases,
views, indexes, triggers, schemas, and so on.

TEXAS A&M-SSI HUB
Alter a table
To alter some of the characteristics of
a table, first specify which table
needs to altered. Thus, using the
Control center's right pane (contents
pane), follow these four steps:
1.

Click on Tables on the left panel
of the Control Center.

2.

Click on the table name that
needs to be altered.

3.

Right click on the table name
and choose Alter .

4.

Follow the 'Alter Table' panels.

With the Alter panel one can change
the data type, the keys , constraints
or the properties of the table.

TEXAS A&M-SSI HUB
Performing Queries
After creating a database and its table
the next step is to perform queries on
them. Queries like Insert, delete, update
or select and so on. Follow the steps
1.

2.

3.

4.

In the Control center select the
database from the left side panel
Select table and it show all the
tables for the particular database
in the right side panel
Select the table in the right hand
panel.
Under the right panel there is an
option for Query, select it

Query

TEXAS A&M-SSI HUB
Cont...
This is the window that
comes up, you can type the
query in the top panel.
If you are using command
panel directly, remember to
connect to the database by
the command
connect to database
name

Type the query here

Result Window

After typing the query press
the green arrow sign, to run
the query.
The result will be displayed
in a new tab window.
In the result set you can
delete or add an row in the
table, there are options of
committing and rollback
present too.
TEXAS A&M-SSI HUB
Query Assist
Another easier way to frame
the queries is to use the SQLAssist.
1.

Click on the selected
tab, then click on SQL
Assist.

2.

SQL Assist

This brings up an
interactive window
through which writing
queries becomes
easier.
SQL Assist Window

TEXAS A&M-SSI HUB
Restricting Usage
To prevent unauthorized users
from messing up with the
database or tables, there is
provision for setting the
privileges granted to the users
1.

On the left panel of the
Control Center and within
the desired database tree,
click on User and Group
Objects -> DB Users .

2.

Click on the desired user on
the right panel of the Control
Center

3.

Here change the privileges

Right-click on the desired
user and choose change.

TEXAS A&M-SSI HUB
Accessing Data Through Java Applications
DB2 provides support for Sun Microsystems's Java Database connectivity (JDBC) API through a
JDBC driver that comes with DB2.
Include the “import java.sql.*” at the top of the source files.
For a Java Class, JDBC driver has to be loaded.
It is better to load it in the constructor.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
After loading the driver connect to the specific database.
// connect to Database :database name, username n password to the database
// Here hub is the name of the database, for different users it could be different.
connection = DriverManager.getConnection("jdbc:db2:hub","db2admin","db2admin");

TEXAS A&M-SSI HUB
Example Java Class
import java.sql.*;
import java.util.*;
import java.lang.*;
public class Calendar
{
private String userName;
private Vector events;
public Calendar(String user)
{
ResultSet rs;
Connection connection;
PreparedStatement getRecords;
try
{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
userName = user;
events = new Vector();
connection = DriverManager.getConnection("jdbc:db2:hub","db2admin","db2admin");
getRecords = connection.prepareStatement("Select * from administrator.Calendar where username = ?");
getRecords.setString(1,this.userName);
rs=getRecords.executeQuery();
while(rs.next())
{
CalendarEvent task =
newCalendarEvent(Integer.parseInt(rs.getString(1)),rs.getString(2),java.sql.Date.valueOf(rs.getString(3))
rs.getString(4),rs.getString(5),rs.getString(6));
events.addElement(task);

}

}

}
rs.close();
getRecords.close();
connection.close();
}
catch(Exception e)
{
System.out.println(e.toString());
}

TEXAS A&M-SSI HUB
Glossary
Database: A relational database presents data as

a collection of tables. The data in each table is
logically related, and relationships can be defined
between tables. Data can be viewed and
manipulated based on mathematical principles and
operations called relations (such as, INSERT,
SELECT, and UPDATE).

Tables: A relational database presents data as a

collection of tables. A table consists of data logically
arranged in columns and rows (generally known as
records)

Table Space: The physical space within a

database is organized into a collection of table
spaces. Each table space consists of a collection of
containers, each of which is an allocation of
physical storage (for example, a directory on a
machine, a physical file, or a device such as a hard
drive).

Schema: A schema is a unique identifier used to
group a set of database objects. Most database
objects have a two-part object name, the first part
being the schema name and the second part is the
name of the object.

Index : An index is a data access aid that can be

created on a table. It is an ordered set of pointers to
rows in a table. Each index is based on the values
of data in one or more columns in a table. An index
is an object that is separate from the data in the
table.

Instance: An instance is a logical database
manager environment where you catalog databases
and set configuration parameters. Multiple
instances can be created on the same physical
server providing a unique database server
environment for each instance.
Alias: An alias is an alternative name for a table,

view, or even another alias. These table-related
aliases are somewhat different from database
aliases. Assigning an alias to a database can avoid
potential client connection problems in
environments where different servers might have
databases with the same name.

Views: A view is the result of a query on one or

more tables. A view looks like a real table, but is
actually just a representation of the data from one
or more tables. A view is a logical or virtual table
that does not exist in physical storage.

TEXAS A&M-SSI HUB
Conclusion
With this basic information, the users are ready to explore the more
complicated actions.
There are various automated tools for Database Maintenance, a
place to get help from could be
http://www106.ibm.com/developerworks/db2/library/techarticle/0
308chong/0308chong.html
To compile this tutorial, help was taken from the tutorial provided by
the IBM website.

TEXAS A&M-SSI HUB

Más contenido relacionado

La actualidad más candente

Vsam presentation PPT
Vsam presentation PPTVsam presentation PPT
Vsam presentation PPT
Anil Polsani
 

La actualidad más candente (20)

DB2 DOCUMENT
DB2 DOCUMENTDB2 DOCUMENT
DB2 DOCUMENT
 
IBM DB2
IBM DB2IBM DB2
IBM DB2
 
DB2 and storage management
DB2 and storage managementDB2 and storage management
DB2 and storage management
 
ALL ABOUT DB2 DSNZPARM
ALL ABOUT DB2 DSNZPARMALL ABOUT DB2 DSNZPARM
ALL ABOUT DB2 DSNZPARM
 
Db2
Db2Db2
Db2
 
DB2 on Mainframe
DB2 on MainframeDB2 on Mainframe
DB2 on Mainframe
 
DB2 utilities
DB2 utilitiesDB2 utilities
DB2 utilities
 
Solving the DB2 LUW Administration Dilemma
Solving the DB2 LUW Administration DilemmaSolving the DB2 LUW Administration Dilemma
Solving the DB2 LUW Administration Dilemma
 
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guruIBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
 
Db2 Important questions to read
Db2 Important questions to readDb2 Important questions to read
Db2 Important questions to read
 
Presentation db2 best practices for optimal performance
Presentation   db2 best practices for optimal performancePresentation   db2 best practices for optimal performance
Presentation db2 best practices for optimal performance
 
Db2 recovery IDUG EMEA 2013
Db2 recovery IDUG EMEA 2013Db2 recovery IDUG EMEA 2013
Db2 recovery IDUG EMEA 2013
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19c
 
DB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in NutshellDB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in Nutshell
 
Db2 and storage management (mullins)
Db2 and storage management (mullins)Db2 and storage management (mullins)
Db2 and storage management (mullins)
 
Oracle 12c Architecture
Oracle 12c ArchitectureOracle 12c Architecture
Oracle 12c Architecture
 
Vsam presentation PPT
Vsam presentation PPTVsam presentation PPT
Vsam presentation PPT
 
12. oracle database architecture
12. oracle database architecture12. oracle database architecture
12. oracle database architecture
 
DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1
 
1. SQL Basics - Introduction
1. SQL Basics - Introduction1. SQL Basics - Introduction
1. SQL Basics - Introduction
 

Similar a Db2 tutorial

Managing SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAManaging SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBA
Concentrated Technology
 
DBA, LEVEL III TTLM Monitoring and Administering Database.docx
DBA, LEVEL III TTLM Monitoring and Administering Database.docxDBA, LEVEL III TTLM Monitoring and Administering Database.docx
DBA, LEVEL III TTLM Monitoring and Administering Database.docx
seifusisay06
 
Db2 migration -_tips,_tricks,_and_pitfalls
Db2 migration -_tips,_tricks,_and_pitfallsDb2 migration -_tips,_tricks,_and_pitfalls
Db2 migration -_tips,_tricks,_and_pitfalls
sam2sung2
 
2005_604_Wagner_ppr
2005_604_Wagner_ppr2005_604_Wagner_ppr
2005_604_Wagner_ppr
Mary Wagner
 

Similar a Db2 tutorial (20)

Project Presentation
Project PresentationProject Presentation
Project Presentation
 
Introduction to database with ms access.hetvii
Introduction to database with ms access.hetviiIntroduction to database with ms access.hetvii
Introduction to database with ms access.hetvii
 
Introduction to database with ms access(DBMS)
Introduction to database with ms access(DBMS)Introduction to database with ms access(DBMS)
Introduction to database with ms access(DBMS)
 
Managing SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAManaging SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBA
 
Mds cdc implementation
Mds cdc implementationMds cdc implementation
Mds cdc implementation
 
12363 database certification
12363 database certification12363 database certification
12363 database certification
 
154090896 installation-of-oracle-database-12c
154090896 installation-of-oracle-database-12c154090896 installation-of-oracle-database-12c
154090896 installation-of-oracle-database-12c
 
Air Line Management System | DBMS project
Air Line Management System | DBMS projectAir Line Management System | DBMS project
Air Line Management System | DBMS project
 
Project seminar
Project seminarProject seminar
Project seminar
 
Dashboard
DashboardDashboard
Dashboard
 
DBA, LEVEL III TTLM Monitoring and Administering Database.docx
DBA, LEVEL III TTLM Monitoring and Administering Database.docxDBA, LEVEL III TTLM Monitoring and Administering Database.docx
DBA, LEVEL III TTLM Monitoring and Administering Database.docx
 
Db2 migration -_tips,_tricks,_and_pitfalls
Db2 migration -_tips,_tricks,_and_pitfallsDb2 migration -_tips,_tricks,_and_pitfalls
Db2 migration -_tips,_tricks,_and_pitfalls
 
KoprowskiT_SQLSat409_MaintenancePlansForBeginners
KoprowskiT_SQLSat409_MaintenancePlansForBeginnersKoprowskiT_SQLSat409_MaintenancePlansForBeginners
KoprowskiT_SQLSat409_MaintenancePlansForBeginners
 
KoprowskiT_SQLSaturday409_MaintenancePlansForBeginners
KoprowskiT_SQLSaturday409_MaintenancePlansForBeginnersKoprowskiT_SQLSaturday409_MaintenancePlansForBeginners
KoprowskiT_SQLSaturday409_MaintenancePlansForBeginners
 
MS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining toolsMS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining tools
 
MS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining toolsMS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining tools
 
Data warehousing labs maunal
Data warehousing labs maunalData warehousing labs maunal
Data warehousing labs maunal
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptx
 
2005_604_Wagner_ppr
2005_604_Wagner_ppr2005_604_Wagner_ppr
2005_604_Wagner_ppr
 
Whats New Sql Server 2008 R2 Cw
Whats New Sql Server 2008 R2 CwWhats New Sql Server 2008 R2 Cw
Whats New Sql Server 2008 R2 Cw
 

Más de The Vision and Insight Corner

2. laporan deputi pada acara penyerahan (LAKIP Pemda)
2. laporan deputi pada acara penyerahan (LAKIP Pemda)2. laporan deputi pada acara penyerahan (LAKIP Pemda)
2. laporan deputi pada acara penyerahan (LAKIP Pemda)
The Vision and Insight Corner
 
Paparan Menteri PAN dan RB: REFORMASI BIROKRASI Mewujudkan BIROKRASI BERSIH,...
Paparan Menteri PAN dan RB: REFORMASI BIROKRASI  Mewujudkan BIROKRASI BERSIH,...Paparan Menteri PAN dan RB: REFORMASI BIROKRASI  Mewujudkan BIROKRASI BERSIH,...
Paparan Menteri PAN dan RB: REFORMASI BIROKRASI Mewujudkan BIROKRASI BERSIH,...
The Vision and Insight Corner
 

Más de The Vision and Insight Corner (20)

KERTASKERJA_AUDITKINERJA_P3DN V1.0.docx
KERTASKERJA_AUDITKINERJA_P3DN V1.0.docxKERTASKERJA_AUDITKINERJA_P3DN V1.0.docx
KERTASKERJA_AUDITKINERJA_P3DN V1.0.docx
 
Kebijakan Strategi Penggunaan Produk Dalam Negeri
Kebijakan Strategi Penggunaan Produk Dalam NegeriKebijakan Strategi Penggunaan Produk Dalam Negeri
Kebijakan Strategi Penggunaan Produk Dalam Negeri
 
Rancangan Indikator Kinerja Program P3DN dan Pengawasan Kolaboratifnya
Rancangan Indikator Kinerja Program P3DN dan Pengawasan KolaboratifnyaRancangan Indikator Kinerja Program P3DN dan Pengawasan Kolaboratifnya
Rancangan Indikator Kinerja Program P3DN dan Pengawasan Kolaboratifnya
 
MANAJEMEN KINERJA: MENGGUNAKAN SISTEM PENGENDALIAN SECARA STRATEGIS SEBAGAI ‘...
MANAJEMEN KINERJA: MENGGUNAKAN SISTEM PENGENDALIAN SECARA STRATEGIS SEBAGAI ‘...MANAJEMEN KINERJA: MENGGUNAKAN SISTEM PENGENDALIAN SECARA STRATEGIS SEBAGAI ‘...
MANAJEMEN KINERJA: MENGGUNAKAN SISTEM PENGENDALIAN SECARA STRATEGIS SEBAGAI ‘...
 
Metamorfosis Menuju Auditor Millenial Handal
Metamorfosis Menuju Auditor Millenial HandalMetamorfosis Menuju Auditor Millenial Handal
Metamorfosis Menuju Auditor Millenial Handal
 
Tantangan Internal Auditor dalam Pandemi COVID-19: Bagaimana BPKP Melakukan T...
Tantangan Internal Auditor dalam Pandemi COVID-19: Bagaimana BPKP Melakukan T...Tantangan Internal Auditor dalam Pandemi COVID-19: Bagaimana BPKP Melakukan T...
Tantangan Internal Auditor dalam Pandemi COVID-19: Bagaimana BPKP Melakukan T...
 
AKSELERASI PENERAPAN MR & PIBR DI KEMENTERIAN/LEMBAGA
AKSELERASI PENERAPAN MR & PIBR DI KEMENTERIAN/LEMBAGAAKSELERASI PENERAPAN MR & PIBR DI KEMENTERIAN/LEMBAGA
AKSELERASI PENERAPAN MR & PIBR DI KEMENTERIAN/LEMBAGA
 
6 Things Public Servants Need During COVID-19
6 Things Public Servants Need During COVID-196 Things Public Servants Need During COVID-19
6 Things Public Servants Need During COVID-19
 
The Impact of Industry 4.0 on Tax System
The Impact of Industry 4.0 on Tax SystemThe Impact of Industry 4.0 on Tax System
The Impact of Industry 4.0 on Tax System
 
the Indonesian President Accountability Support Systems (PASS)
the Indonesian President Accountability Support Systems (PASS)the Indonesian President Accountability Support Systems (PASS)
the Indonesian President Accountability Support Systems (PASS)
 
3. tayangan penyerahan balai kartini (LAKIP Pemda)
3. tayangan penyerahan balai kartini (LAKIP Pemda)3. tayangan penyerahan balai kartini (LAKIP Pemda)
3. tayangan penyerahan balai kartini (LAKIP Pemda)
 
2. laporan deputi pada acara penyerahan (LAKIP Pemda)
2. laporan deputi pada acara penyerahan (LAKIP Pemda)2. laporan deputi pada acara penyerahan (LAKIP Pemda)
2. laporan deputi pada acara penyerahan (LAKIP Pemda)
 
1. penyerahan lhe akip kabupaten
1. penyerahan lhe akip kabupaten1. penyerahan lhe akip kabupaten
1. penyerahan lhe akip kabupaten
 
Paparan Menteri PAN dan RB: REFORMASI BIROKRASI Mewujudkan BIROKRASI BERSIH,...
Paparan Menteri PAN dan RB: REFORMASI BIROKRASI  Mewujudkan BIROKRASI BERSIH,...Paparan Menteri PAN dan RB: REFORMASI BIROKRASI  Mewujudkan BIROKRASI BERSIH,...
Paparan Menteri PAN dan RB: REFORMASI BIROKRASI Mewujudkan BIROKRASI BERSIH,...
 
DB2 Upgrade instructions
DB2 Upgrade instructionsDB2 Upgrade instructions
DB2 Upgrade instructions
 
Quick beginning for db2 server
Quick beginning for db2 serverQuick beginning for db2 server
Quick beginning for db2 server
 
Hadr db2express
Hadr db2expressHadr db2express
Hadr db2express
 
Getting started with_data_studio_for_db2
Getting started with_data_studio_for_db2Getting started with_data_studio_for_db2
Getting started with_data_studio_for_db2
 
Db2 howto-linux
Db2 howto-linuxDb2 howto-linux
Db2 howto-linux
 
Db2exc guide 952_mac_x86_64
Db2exc guide 952_mac_x86_64Db2exc guide 952_mac_x86_64
Db2exc guide 952_mac_x86_64
 

Último

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 

Db2 tutorial

  • 2. DB2 is a multi-platform scalable, object-relational database server. This tutorial is for people with little or no experience with DB2. DB2 GUIS Over-View. Step by Step approach of how to accomplish some of the most important database tasks. Database tasks can be achieved in various ways, in this tutorial, the focus is on using the GUI tools Glossary is provided at the end, for the terms used in DB2. TEXAS A&M-SSI HUB
  • 3. Key Capabilities and Benefits Superior scalability DB2 Universal Database can run on everything from laptops supporting mobile users to massively parallel systems with terabytes of data and/or thousands of users. Multimedia extensibility It allows to extend the capabilities of the database to meet your specific organizational requirements. This includes the ability to support more advanced applications involving multimedia data such as documents, images, audio, video, and spatial data. Complete web-enablement One of the key new application areas is e-business. DB2 Universal Database is fully integrated with web technology so that data can be easily accessed from the Internet or from the company intranet Universal access DB2 Universal database can be accessed from almost any client workstation over almost any network. Multi-platform support DB2 Universal database is one of the most open database platforms available. It runs on the most popular UNIX and Intel server platforms, including AIX, HP-UX, Solaris, Linux, NUMA-Q, OS/2, and Windows. http://www-306.ibm.com/software/data/db2/udb/about.html TEXAS A&M-SSI HUB
  • 4. IBM DB2 - Menus After you have installed DB2,these are various options you will see if you go to IBM DB2 in the main programs. To reach the various GUIS, go to All Programs IBM DB2 Various options. Command Editor Development Center Control Center Health Center Configuration Assistant TEXAS A&M-SSI HUB
  • 5. The Command Editor This tool allows the user to input SQL statements or DB2 commands in an interactive window and see the results. Type the SQL statements or DB2 commands here. The result can be seen in this part if the window TEXAS A&M-SSI HUB
  • 6. Development Center Currently for class-projects you wont need to use the Development center as this is the tool that the administrator uses it to create stored-procedure or UDF (User define function). It is used for creating objects, the source code is copied on the server and the object is registered in the catalog table. when a Java object is built, it is complied on the Client application. TEXAS A&M-SSI HUB
  • 7. Control Center This is without a doubt the most important DB2 GUI tool. It provides you with a whole picture of your instances and databases, and allows the user to perform most database operations in DB2. T R E E S T R U C T U R E Detailed information about the item selected. If you select them you can further modify them. More Wizard like help for the item selected. TEXAS A&M-SSI HUB
  • 8. Health Center Use the Health Center GUI tool to set up thresholds that, when exceeded, will prompt alert notifications, or even actions to relieve the situation. In other words, you can have the database manage itself! TEXAS A&M-SSI HUB
  • 9. Configuration Assistant If a user has DB2 UDB installed on the desktop in College Station, but would like to connect to a DB2 Server in Germany. How can the user connect to this remote server? The Configuration Assistant GUI tool can help with the set up and testing of the connection, The Task Center TEXAS A&M-SSI HUB
  • 10. Creating a Database To create a database there are various options either one can create a database from the Command Centre or the Control Center. The option from the Control center is easy as it has a wizard that will guide through the process. Here the database creation through the Control Center is explained. Click on Databases on the left panel of the Control Center Right click on Databases and choose create -> Standard. Follow the panels from the create database wizard. TEXAS A&M-SSI HUB Standard
  • 11. Cont... The wizard guides through the step by step process of creating the database, it asks for a database name, location to store the database and the various options about the maintenance of the data base. TEXAS A&M-SSI HUB
  • 12. Creating a Table From the Control Center again we would need three steps: 1. Click on Tables on the left panel of the Control Center. 2. Right click on Tables and choose Create . 3. Follow the panels from the create table wizard. TEXAS A&M-SSI HUB
  • 13. Cont... This is how the wizard for creating a table looks like, it will ask for information and the user just fills in the blanks to create the columns in a table, long with the columns the user can also provide information about the constraints, keys. Following this same procedure one can create aliases, views, indexes, triggers, schemas, and so on. TEXAS A&M-SSI HUB
  • 14. Alter a table To alter some of the characteristics of a table, first specify which table needs to altered. Thus, using the Control center's right pane (contents pane), follow these four steps: 1. Click on Tables on the left panel of the Control Center. 2. Click on the table name that needs to be altered. 3. Right click on the table name and choose Alter . 4. Follow the 'Alter Table' panels. With the Alter panel one can change the data type, the keys , constraints or the properties of the table. TEXAS A&M-SSI HUB
  • 15. Performing Queries After creating a database and its table the next step is to perform queries on them. Queries like Insert, delete, update or select and so on. Follow the steps 1. 2. 3. 4. In the Control center select the database from the left side panel Select table and it show all the tables for the particular database in the right side panel Select the table in the right hand panel. Under the right panel there is an option for Query, select it Query TEXAS A&M-SSI HUB
  • 16. Cont... This is the window that comes up, you can type the query in the top panel. If you are using command panel directly, remember to connect to the database by the command connect to database name Type the query here Result Window After typing the query press the green arrow sign, to run the query. The result will be displayed in a new tab window. In the result set you can delete or add an row in the table, there are options of committing and rollback present too. TEXAS A&M-SSI HUB
  • 17. Query Assist Another easier way to frame the queries is to use the SQLAssist. 1. Click on the selected tab, then click on SQL Assist. 2. SQL Assist This brings up an interactive window through which writing queries becomes easier. SQL Assist Window TEXAS A&M-SSI HUB
  • 18. Restricting Usage To prevent unauthorized users from messing up with the database or tables, there is provision for setting the privileges granted to the users 1. On the left panel of the Control Center and within the desired database tree, click on User and Group Objects -> DB Users . 2. Click on the desired user on the right panel of the Control Center 3. Here change the privileges Right-click on the desired user and choose change. TEXAS A&M-SSI HUB
  • 19. Accessing Data Through Java Applications DB2 provides support for Sun Microsystems's Java Database connectivity (JDBC) API through a JDBC driver that comes with DB2. Include the “import java.sql.*” at the top of the source files. For a Java Class, JDBC driver has to be loaded. It is better to load it in the constructor. Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); After loading the driver connect to the specific database. // connect to Database :database name, username n password to the database // Here hub is the name of the database, for different users it could be different. connection = DriverManager.getConnection("jdbc:db2:hub","db2admin","db2admin"); TEXAS A&M-SSI HUB
  • 20. Example Java Class import java.sql.*; import java.util.*; import java.lang.*; public class Calendar { private String userName; private Vector events; public Calendar(String user) { ResultSet rs; Connection connection; PreparedStatement getRecords; try { Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); userName = user; events = new Vector(); connection = DriverManager.getConnection("jdbc:db2:hub","db2admin","db2admin"); getRecords = connection.prepareStatement("Select * from administrator.Calendar where username = ?"); getRecords.setString(1,this.userName); rs=getRecords.executeQuery(); while(rs.next()) { CalendarEvent task = newCalendarEvent(Integer.parseInt(rs.getString(1)),rs.getString(2),java.sql.Date.valueOf(rs.getString(3)) rs.getString(4),rs.getString(5),rs.getString(6)); events.addElement(task); } } } rs.close(); getRecords.close(); connection.close(); } catch(Exception e) { System.out.println(e.toString()); } TEXAS A&M-SSI HUB
  • 21. Glossary Database: A relational database presents data as a collection of tables. The data in each table is logically related, and relationships can be defined between tables. Data can be viewed and manipulated based on mathematical principles and operations called relations (such as, INSERT, SELECT, and UPDATE). Tables: A relational database presents data as a collection of tables. A table consists of data logically arranged in columns and rows (generally known as records) Table Space: The physical space within a database is organized into a collection of table spaces. Each table space consists of a collection of containers, each of which is an allocation of physical storage (for example, a directory on a machine, a physical file, or a device such as a hard drive). Schema: A schema is a unique identifier used to group a set of database objects. Most database objects have a two-part object name, the first part being the schema name and the second part is the name of the object. Index : An index is a data access aid that can be created on a table. It is an ordered set of pointers to rows in a table. Each index is based on the values of data in one or more columns in a table. An index is an object that is separate from the data in the table. Instance: An instance is a logical database manager environment where you catalog databases and set configuration parameters. Multiple instances can be created on the same physical server providing a unique database server environment for each instance. Alias: An alias is an alternative name for a table, view, or even another alias. These table-related aliases are somewhat different from database aliases. Assigning an alias to a database can avoid potential client connection problems in environments where different servers might have databases with the same name. Views: A view is the result of a query on one or more tables. A view looks like a real table, but is actually just a representation of the data from one or more tables. A view is a logical or virtual table that does not exist in physical storage. TEXAS A&M-SSI HUB
  • 22. Conclusion With this basic information, the users are ready to explore the more complicated actions. There are various automated tools for Database Maintenance, a place to get help from could be http://www106.ibm.com/developerworks/db2/library/techarticle/0 308chong/0308chong.html To compile this tutorial, help was taken from the tutorial provided by the IBM website. TEXAS A&M-SSI HUB