View • Attachments (6) • Info
New to DB2?
This "New to DB2" document provides you with a good foundation about DB2 in the least time possible. Each subsection includes an estimated time to complete. The last section provides resources if you require more information.
Time estimate: 7 minute
DB2 is a data server; it is used to store and retrieve data. DB2 commands and SQL statements are used to interact with the DB2 server allowing you to create objects, and to manipulate your data with insert, update, delete, or select statements. Different tools can be used to input these commands and statements as shown in Figure 1. This figure provides an overview of DB2 and has been extracted from the book Understanding DB2 - Learning Visually with Examples.![]()

Figure 1 - DB2 overview
We will discuss some of the elements of this figure in more detail in subsequent sections.
DB2 Server Packaging
DB2 server products are created using the same core components, and then packaged in a way that allows users to choose the functions they need for the right price. Figure 2 illustrates this.

Figure 2 - DB2 Server Packaging
As shown in Figure 2, the arrow highlights where DB2 Express-C fits in the picture. DB2 Express-C is the same as DB2 Express without a few components. DB2 Express-C is free to the community, and technical support is only available through an online forum
. Figure 2 also explains why it is so easy to upgrade from DB2 Express-C to any of the other DB2 servers should you need to in the future: All DB2 servers have the same core components.
DB2 Clients
When you install a DB2 server, a DB2 client component is also installed. If you want to install only a client, you can download it here
.
There is no charge to use DB2 clients, which come in three flavors as illustrated in Figure 3.

Figure 3 - DB2 Clients
In Figure 3, the Runtime client is the smallest client providing all the support and drivers needed to connect to a DB2 server. The DB2 Administration client is simply the same as the runtime client plus adminstration GUI tools. The Application developement client is the same as the Administration client plus header files, sample code, and language libraries for application development.
For more information, review these articles:
Comparing the distributed DB2 UDB servers![]()
Which distributed edition of DB2 Version 8 is right for you?![]()
Time estimate: 13 minutes
Figure 4 provides a quick overview of the main DB2 system components.

Figure 4 - DB2 System overview
Please note that the commands shown in this section can also be performed from GUI Tools, as we will illustrate in later sections.
An instance is an environment where database objects can be created. On the same server, you can create several instances, each of which is treated independently. For example, you can use an instance for test, another one for developement, another one for production. Table 1 shows some useful commands you can use at the instance level.
| Command | Description |
|---|---|
| db2start | Starts the current instance |
| db2stop | Stops the current instance |
| db2icrt | Creates a new instance |
| db2idrop |
Drops an instance |
| db2ilist |
Lists the instances you have on your system |
| db2 get instance |
Lists the current active instance |
Within an instance you can create many databases. A database is a collection of objects such as tables, views, indexes, and so on. Table 2 shows some commands you can use at the database level.
Table 2 - Commands/SQL Statements at the database level
| Command/SQL statement | Description |
|---|---|
| db2 create database |
Creates a new database |
| db2 drop database |
Drops a database |
| db2 connect to <database_name> | Connects to a database |
| db2 create table/create view/create index | SQL statements to create table, views, and indexes respectively |
DB2 configuration
DB2 parameters can be configured using the Configuration Advisor. The configuration advisor can be accessed through the Control Center (Right click on a database and choose "Configuration Advisor"). Based on your answers to some questions about your system resources and workload, the configuration advisor will provide a list of DB2 parameters that should be changed with a suggested value. If you would like more detail about DB2 configuration, keep reading. Otherwise, use the Configuration Advisor and you are good to work with DB2!
A DB2 server can be configured at four different levels (as shown in Figure 4).
1) Environment variables are variables set at the operating system level. The main environment variable to be concerned about is DB2INSTANCE. This variable indicates the active instance you are working on, and for which your DB2 commands would apply.
2) Database Manager Configuration File (dbm cfg) includes parameters that affect the instance and all the databases it contains. Table 3 shows some useful commands to manage the dbm cfg.
Table 3 - Commands to manipulate the dbm cfg
| Command |
Description |
|---|---|
| db2 get dbm cfg | Retrieves information about the dbm cfg |
| db2 update dbm cfg using <parameter_name> <value> | Updates the value of a dbm cfg parameter |
3) Database Configuration File (db cfg) includes parameters that affect the particular database in question. Table 4 shows some useful commands to manage the db cfg
Table 4 - Commands to manipulate the db cfg
| Command |
Description |
|---|---|
| get db cfg for <database_name> | Retrieves information about the db cfg for a given database |
| update db cfg for <database_name> using <parameter_name> <value> | Updates the value of a db cfg parameter |
4) DB2 Profile Registry variables includes parameters that may be platform specific and can be set globally (affecting all instances), or at the instance level (affecting one particular instance). Table 5 shows some useful commands to manipulate the DB2 profile registry
Table 5 - Commands to manipulate the DB2 profile registry
| Command | Description |
|---|---|
| db2set -all | Lists all the DB2 profile registry variables that are set |
| db2set <parameter>=<value> | Sets a given parameter with a value |
DB2 Tools
The main DB2 tool you will use is the Control Center illustrated in Figure 5.

Figure 5 - The DB2 Control Center
The Control Center can be invoked from a Command prompt or Linux shell by issuing the command "db2cc". The Control Center is a centralized administration tool that allows you to view your systems, instances, databases and database objects. Right clicking on the different folders/objects in the Object tree will pop up menus applicable to the given folder/object. For example, right-clicking on an instance, and choosing "Configure parameters" would allow you to view and update the dbm cfg. Similarly, if you right-click on a database and choose "Configure parameters", you would be able to view and update the db cfg.
For more information about the DB2 environment and configuration parameters, review this article:
A colorful introduction to DB2 UDB, Version 8 for UNIX, Linux, and Windows
.
For more information about the DB2 GUI tools, review this article:
An Introduction to DB2 UDB Express GUI tools
.
Time Estimate: 5 minutes
In this section we explain how to install DB2 using the DB2 setup wizard.
Installation on Windows
Steps:
Installation on Linux
Steps:
For more information about other installation methods, review this article:
Installing DB2 Products Across Your Enterprise
.
Time Estimate: 7 minutes
If your database is local, that is, it resides on the same system where you are performing your database operations, there is no setup required. You can simply issue a "connect to database_name" statement to connect to the database.
If your database is remote, the simplest method to set up database connectivity is by using the Configuration Assistant. Follow these steps:
1. Start the Configuration Assistant from the system where you want to connect to the database. (Use "db2ca" from a Windows command prompt or Linux shell). Figure 6 shows the Configuration Assistant.

Figure 6 - The DB2 Configuration Assistant
2. From the Configuration Assistant, click on the "Selected --> Add database using Wizard" menu
3. From the "Select how you want to set up a connection" window, you can use "Search the network" if your network is small with not many hubs.
6. After you finish your set up, test your connection from the Configuration Assistant by right-clicking on the database, and choosing "Test Connection"
For more information, review this article:
DB2 Version 8 Connectivity Cheat Sheet
.
Time estimate: Depends on the number of programs you try
All of the following basic sample programs will connect to a database, and retrieve one record. We suggest you first download
all the sample programs in this section:
Time estimate: 2 minutes
The DB2 Information Center provides the most up-to-date online DB2 documentation. The DB2 Information Center is a web application. You can access the DB2 Information Center online
, or you can download and install the DB2 Information Center to your local computer. Links to the online DB2 Information Center as well as downloadable versions are available here
.
To help you quickly search the DB2 Information Center you can install an OpenSearch plugin in your browser (IE 7 or later, Firefox 2 or later, and others). See http://www.ibm.com/software/data/db2/udb/support/icinfo.html
for more details. You can also search the Information Center using Google
through a search form on the IDUG
site.
If you prefer to print a copy of the DB2 manuals, you can obtain PDF versions for DB2 V8.2
or DB2 9![]()
Refer to this article
for other sources of DB2 documentation.
|
Browse Space |
Explore Confluence |
Your Account |
Add Content |
|
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.3.3 Build:#645 Feb 13, 2007) |