Configuring and verifying installation of DB2 UDB 6.1
Before you can run WebSphere Application Server, you must create
a DB2 UDB instance and the database named was
, which WebSphere Application
Server uses.
Creating a database instance
- Ensure that you are logged into the machine with superuser (root) privileges.
- Navigate to the directory containing the DB2 Installer by entering the
following command: # cd /opt/IBMdb2/V6.1/install
- Start the DB2 Installer by entering the following command:
# ./db2setup
- On the DB2 Installer screen, highlight the Create button beside the option labeled To create
a DB2 Instance, or the Administration Server, select Create and press Return.
- On the Create DB2 Services screen, highlight the Create the Administration
Server option and press Return.
- On the Administration Server screen, perform the
following steps, noting the values that you enter or accept for future reference:
- Enter a user name or accept the default value for the User Name option.
- Enter a user ID or accept the default user ID by ensuring that the
Use default UID option has an asterisk (*) beside it.
- Enter a group name or accept the default value for the Group Name option.
- Enter a group ID or accept the default group ID by ensuring that the Use
default GID option has an asterisk (*) beside it.
- Enter a home directory or accept the default value for the Home Directory
option. (Ensure that the home directory that you specify already exists on your system before
trying to create the Administration Server.)
- Type a password for the user in the Password and Verify Password
options. DB2 requires a password of 8 or fewer characters.
- Highlight OK and press Return.
- A Notice screen informs you of the value being created for the DB2SYSTEM environment
variable. Ensure that OK is highlighted and press Return.
- On the Create DB2 Services screen, highlight the Create a DB2 Instance
option and press Return.
- On the DB2 Instance screen, perform the following steps,
noting the values that you enter or accept for future reference:
- Enter a user name or accept the default value for the User Name option.
- Enter a user ID or accept the default user ID by ensuring that the Use
default UID option has an asterisk (*) beside it. The user ID is the DB2
instance owner and is needed for installing WebSphere Application Server.
- Enter a group name or accept the default value for the Group Name option.
- Enter a group ID or accept the default group ID by ensuring that the Use
default GID option has an asterisk (*) beside it.
- Enter a home directory or accept the default value for the Home Directory
option. (Ensure that the home directory that you specify already exists on your system before
trying to create the Instance.)
- Type a password for the user in the Password and Verify Password
options. DB2 requires a password of 8 or fewer characters.
- Highlight OK and press Return.
- On the Fenced User screen, perform the following steps, noting the values that
you enter or accept for future reference:
- Enter a user name or accept the default value for the User Name option.
- Enter a user ID or accept the default user ID by ensuring that the Use
default UID option has an asterisk (*) beside it.
- Enter a group name or accept the default value for the Group Name option.
- Enter a group ID or accept the default group ID by ensuring that the Use
default GID option has an asterisk (*) beside it.
- Enter a home directory or accept the default value for the Home Directory
option. (Ensure that the home directory that you specify already exists on your system before
trying to create the Fenced User.)
- Type a password for the user in the Password and Verify Password
options.
- Highlight OK and press Return.
- On the Create DB2 Services screen, highlight OK and press Return. The
Summary Report screen is displayed, summarizing all of the choices you have made so far.
- Verify the information on the Summary Report screen. When you have determined
that it is correct, ensure that Continue is highlighted and press Return. A
Warning screen is displayed, giving you the option of canceling the processes.
- On the Warning screen, ensure that OK is highlighted and press Return.
- A Notice screen informs you when the processes have completed. Ensure that
OK is highlighted and press Return.
- The Status Report screen informs you of process successes and failures. View
the Log File for information on how to correct particular failures. To exit this
screen, ensure that OK is highlighted and press Return.
- On the DB2 Installer screen, highlight Close and press Return.
- On the Notice screen, ensure that OK is highlighted and press Return.
- Make root a member of the administrative group that you accepted or designated
for the Group Name option during the creation of the Administrative Server
in Step 6.
- Create symbolic links by entering the following command:
# /opt/IBMdb2/V6.1/cfg/db2ln
- Configure the instance owner (the value that you accepted or designated for
the User Name option in Step 9) to run db2profile
on startup, by doing one of the following:
- For the Korn shell, add the following line to the .profile file of the instance
owner (for instance, db2inst1). Note the space between the period (.) and the first forward slash (/):
. /export/home/db2inst1/sqllib/db2profile
- For the C shell, add the following line to the .cshrc file of instance owner
(for instance, db2inst1):
source /export/home/db2inst1/sqllib/db2cshrc
- Configure root to run db2profile on startup. This is required to install
and run WebSphere Application Server.
Verifying installation of DB2 UDB 6.1
To demonstrate that DB2 is functioning correctly, create a sample
database and then compile and execute a Java application that accesses
this database. The following steps establish that the correct
environment is available for DB2 and the IBM Java Development Kit (JDK) and that the
Java Database Connectivity (JDBC)
driver is accessible from a Java application.
To create the sample database and compile and run the Java application, perform the
following steps:
- Log in as the DB2 instance owner (the value that you specified
for the User Name option in Step 9 in "Creating a
database instance").
Note that when you log in as the instance owner, the command prompt appears as
$
, rather than #
, to indicate your login identity.
- To ensure that the DB2 profile has been set correctly, search the environment
for the value of DB2INSTANCE by entering the following command. The value returned
must be the instance owner name (the value that you specified for
the User Name option in Step 9 in "Creating a
database instance"):
$ env | grep DB2INSTANCE
- Enter the following command to create the sample database. This process can
take several minutes to complete.
$ db2sampl
- Compile an example Java application, placing the resulting class file in the
local directory, by entering the following command:
$ javac -d . sqllib/samples/java/DB2Appl.java
- Start DB2 by entering the following command:
$ db2start
- Execute the sample by entering the following command:
$ java DB2Appl
Your output appears like the following:
Retrieve some data from the database...
Received results:
empno= 000010 firstname= CHRISTINE
empno= 000020 firstname= MICHAEL
empno= 000030 firstname= SALLY
. . .
Update the database...
Changed 1 row.
- To log out, enter control-D (
^D
) at the command prompt.
Creating and configuring a database for WebSphere Application Server
Create a database named was
and set its DB2 application heap size
by performing the following steps:
- Log in as the DB2 instance owner (the value that you specified
for the User Name option in Step 9 in "Creating
a database instance").
Note that when you log in as the instance owner, the command prompt appears as
$
, rather than #
, to indicate your login identity.
- Enter the following command to start DB2:
$ db2start
- Enter the following command to create a database named
was
.
This process can take several minutes to complete.
$ db2 create database was
- Enter the following command to set the application heap size:
$ db2 update db config for WAS using applheapsz 256
- Restart the machine. If an application heap size of 256 does not work for your
system, increase the size, for example, to 512.
Configuring the database manager to use TCP/IP
It is recommended that you configure the database manager to use TCP/IP to
connect to WebSphere Application Server remotely. Because you are using a local DB2 database with
WebSphere Application Server (both DB2 and WebSphere Application Server are
installed on the same machine), you will perform all of the steps in the following
procedure on the same machine.
Perform the following steps to configure the database manager to use TCP/IP to
connect to WebSphere Application Server remotely:
- Ensure that you are logged into the machine with superuser (root) privileges.
- Ensure that your DISPLAY and TERM environment variables are set properly.
- Use a text editor to open the /etc/services file. If it does not specify DB2 connection
and interrupt service ports, add the following text to specify the ports:
server1 50000/tcp # DB2 connection service port
server1i 50001/tcp # DB2 interrupt connection service port
- Log in as the DB2 instance owner (the value that you accepted or designated
for the User Name option in Step 9 in the section "Creating
a database instance"). In this example, the DB2 instance owner name is db2inst1.
# su - db2inst1
Logging in as the instance owner places you automatically in the home directory of the instance owner.
The command prompt changes in appearance to indicate the change in your login identity.
- Ensure that your DISPLAY and TERM environment variables are set properly.
- Set DB2COMM to TCP/IP by using the db2set command, as follows:
$ db2set DB2COMM=tcpip
- Update the database manager configuration by using the db2 update command, as follows:
$ db2 update dbm cfg using svcename DB2_connection_service_port
In this command, DB2_connection_service_port represents the name of the DB2 connection
service port you specified in the /etc/services file (for example, server1).
- Catalog the TCP/IP node by using the db2 catalog command, as follows:
$ db2 catalog tcpip node WASNODE remote host_name \
server DB2_connection_service_port
In this command, host_name represents the client machine name or IP address
and DB2_connection_service_port represents the DB2 connection service port server
name or port number you specified in the /etc/services file (for example, server1 or 50000).
- Catalog the database by using the db2 catalog command, as follows:
$ db2 catalog database was as wasAlias at node WASNODE
- Stop and start DB2 for your changes to take effect by using the db2stop
and db2start commands, as follows:
$ db2stop
$ db2start
- To log out as the DB2 instance owner, enter the following command:
$ exit
The DB2 server remains active unless you stop it by using the db2stop command.
Verifying connection to the was database
To verify connection to the was database, perform the following steps:
- Log in as the DB2 instance owner (the value that you specified for the
User Name option in Step 9 in "Creating a database instance").
Note that when you log in as the instance owner, the command prompt appears as
$
, rather than #
, to indicate your login identity.
- Enter the command:
$ db2 connect to was
Your output appears like the following (assuming an instance name of db2inst1):
Database Connection Information
Database server = DB2/SUN 6.1.0
SQL authorization ID = DB2INST1
Local database alias = WAS
- To log out, enter control-D (
^D
) at the command prompt.