Configuring DB2 Universal Database (UDB) 7.2 for use with WebSphere Application Server
This article describes how to do the following:
- Create a DB2 instance and administration server
- Verify installation of DB2 UDB
- Create and configure a database named
was40 , which is used by WebSphere Application Server
- Verify connection to the
was40 database
- Configure WebSphere Application Server when dropping and reinstalling the
was40 administrative database
The procedures in this article assume that DB2 is installed in the default location
/opt/IBMdb2/V7.2 and that any required FixPak is installed.
Creating a database instance and administration server
- Ensure that you are logged into the machine with superuser (root) privileges.
- Create users for the DB2 Instance, DB2 Fenced user, and DB2 Administration Server. These user names
must match the values for the User Name option that you designate when configuring
the DB2 Instance, DB2 Fenced user, and DB2 Administration Server in
the procedures listed under Steps 9, 10, and 14.
- Create groups for the DB2 Instance, DB2 Fenced user, and DB2 Administration Server. These group names
must match the values for the Group Name option that you designate when configuring
the DB2 Instance, DB2 Fenced user, and DB2 Administration Server in
the procedures listed under Steps 9, 10, and 14.
- Modify the users that you created in Step 2 by doing the following:
- Make the primary group for the DB2 Instance user the group that you created for the DB2 Instance in Step 3.
- Make the primary group for the DB2 Fenced user the group that you created for the DB2 Fenced user in Step 3.
- Make the primary group for the DB2 Administration Server user the group that you created for the DB2 Administration Server user in Step 3.
- Navigate to the directory containing the DB2 Setup Utility by entering the
following command:
# cd /opt/IBMdb2/V7.2/install
- Start the DB2 Setup Utility by entering the following command:
# ./db2setup
When you start DB2 with the db2setup command, the compat-2001.5.29-0.s390.rpm package must also be installed. Otherwise, the installer is unable to load the libstdc++-libc6.1-2.so.3 library. You must verify the compat-2001.5.29-0.s390.rpm package is installed by issuing the rpm -qa|grep compat-2001.5.29-0 command. If the package name is not returned as the command output, locate the rpm file on your base SuSe SLES CD-ROMs and install it.
- Highlight the Create button beside the option labeled To create
a DB2 Instance, an Administration Server, or a Data Links Manager Administrator select
Create and press Return.
- In the Create DB2 Services window, highlight the Create a DB2 Instance
option and press Return.
- In the DB2 Instance window, 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. You will specify this user
name when you configure WebSphere Application Server. This user name must match the
one that you created for the DB2 Instance in Step 2.
- 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. This group name must match the
one that you created for the DB2 Instance in Step 3.
- 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. You will specify this directory when you configure WebSphere Application Server.
This home directory must match the one that you created for the DB2 Instance user in Step 2.
- Type a password for the user in the Password and Verify Password
options. DB2 requires a password of eight or fewer characters. You will specify this password
when you configure WebSphere Application Server.
- Highlight OK and press Return.
- In the Fenced User window, 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. This user name must match the
one that you created for the DB2 Fenced user in Step 2.
- 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. This group name must match the
one that you created for the DB2 Fenced user in Step 3.
- 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. This home directory must match the one that you created for the DB2 Fenced user in Step 2.
- Type a password for the user in the Password and Verify Password
options. DB2 requires a password of eight or fewer characters.
- Highlight OK and press Return.
- In the DB2 Warehouse Control Database window, highlight the option labeled Do not set up DB2
Warehouse Control Database and press Return.
- Highlight OK and press Return.
- In the Create DB2 Services window, highlight the Create the Administration
Server option and press Return.
- In the Administration Server window, 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. This user name must match the
one that you created for the DB2 Administration Server in Step 2.
- 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. This group name must match the
one that you created for the DB2 Administration Server in Step 3.
- 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. This home directory must match the
one that you created for the DB2 Administration Server user in Step 2.
- Type a password for the user in the Password and Verify Password
options. DB2 requires a password of eight or fewer characters.
- Highlight OK and press Return.
- A notice window informs you of the value being created for the DB2SYSTEM environment
variable. Ensure that OK is highlighted and press Return.
- In the Create DB2 Services window, highlight OK and press Return.
- The Summary Report window summarizes the choices you have made so far.
When you have determined that the information is correct, ensure that Continue
is highlighted and press Return.
- A warning window opens, giving you the option of canceling the processes.
Ensure that OK is highlighted and press Return.
- A notice window informs you when the processes are completed. Ensure that
OK is highlighted and press Return.
- The Status Report window informs you of process successes and failures. View
the Log File for information on how to correct particular failures. To exit from this
window, ensure that OK is highlighted and press Return.
- In the DB2 Setup Utility window, highlight Close and press Return.
- In the notice window, ensure that OK is highlighted and press Return.
- Make the root user 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 14.
- If you are developing or running applications and want to avoid specifying the
full path to the product libraries and include files, consider creating symbolic links.
Create symbolic links for the DB2 files to the /usr/lib directory and for the
include files to the /usr/include directory by entering the following command:
# /opt/IBMdb2/V7.2/cfg/db2ln
- Configure the instance owner (the value that you accepted or designated for
the User Name option in Step 9, in this example, db2inst1) to run the
db2profile script at login, by doing one of the following (assuming that /home/db2inst1 is the home directory of
the example instance owner db2inst1):
- If the instance owner uses the Korn shell, add the following line to
the .profile file of the instance owner. Note the space between the period (.) and the first forward slash (/):
. /home/db2inst1/sqllib/db2profile
- If the instance owner uses the C shell, add the following line
to the .cshrc file of the instance owner:
source /home/db2inst1/sqllib/db2cshrc
Note: You might need to create the .profile or .cshrc file if it does not already exist. If the instance owner
uses a shell other than the Korn shell or C shell, make appropriate changes to this information.
- Configure the root user to run the db2profile script at login by adding the following line to the
.profile or .dtprofile file for the user root (assuming that the user root uses the Korn or Bourne shell and that
/home/db2inst1 is the home directory of the example instance owner db2inst1):
. /home/db2inst1/sqllib/db2profile
This action is required to install and run WebSphere Application Server. If the user root uses a shell
other than the Korn shell or Bourne shell, make appropriate changes to this information.
- Log out and then log back in for your changes to take effect.
Verifying the installation of DB2 UDB
To demonstrate that DB2 is functioning correctly, create a sample
database and then compile and execute a Java application that accesses
this database.
To create a sample database and compile and run the Java application, perform the
following steps:
- Log in as the DB2 instance owner (the value that you accepted or designated
for the User Name option in Step 9 in the procedure in
the section "Creating a database instance and administration server").
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.
- To ensure that the DB2 environment has been set up correctly, search the environment
for the value of the DB2INSTANCE environment variable by entering the following command. The value returned
must be the instance owner name (the value that you accepted or designated for
the User Name option in Step 9 in the procedure in the
section "Creating a database instance and administration server"):
$ env | grep DB2INSTANCE
- Create the sample database by executing the db2sampl script, as follows. This process can
take several minutes to complete.
$ db2sampl
- Ensure that you are in the home directory of the instance owner (in this example, /home/db2inst1) and
compile an example Java application by using the javac command, as follows:
$ javac -d . sqllib/samples/java/DB2Appl.java
The resulting class file is created in the local directory.
- Ensure that DB2 is running or start it by entering the following command:
$ db2start
- Execute the sample by using the java command, as follows:
$ java DB2Appl
Your output appears like the following:
Retrieve some data from the database...
Received results:
empno= 000010 firstname= SHILI
empno= 000020 firstname= MICHAEL
empno= 000030 firstname= SALLY
. . .
Update the database...
Changed 1 row.
- If you want to stop DB2, enter the following command:
$ db2stop
- To log out as the DB2 instance owner, enter the following command:
$ exit
The DB2 server remains active unless you stop it as detailed in Step 8.
Creating and configuring a database for WebSphere Application Server
In order for WebSphere Application Server to store the administrative configuration, you must
create a database on the database server node. The database name will be
the same one (or alias) used for the JDBC URL entry name during
the WebSphere Application Server installation. Perform the following steps to
create a database named was40 and set the DB2 application heap size:
- Log in as the DB2 instance owner (the value that you accepted or designated
for the User Name option in Step 9 in the procedure in
the section "Creating a database instance and administration server").
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.
- To ensure that the DB2 environment has been set up correctly, search the environment
for the value of the DB2INSTANCE environment variable by entering the following command. The value returned
must be the instance owner name (the value that you accepted or designated for
the User Name option in Step 9 in the procedure in the
section "Creating a database instance and administration server"):
$ env | grep DB2INSTANCE
- Ensure that DB2 is running or start it by entering the following command:
$ db2start
- Enter the following command to create a database named
was40 .
This process can take several minutes to complete.
$ db2 create database was40
- Enter the following command to set the application heap size:
$ db2 update db config for WAS40 using applheapsz 256
- In order for your changes to take effect, you must start and stop DB2.
To do this, enter the following commands:
$ db2stop
$ db2start
If an application heap size of 256 does not work for your
system, increase the size to 512.
- 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 was40 database
Perform the following steps to verify connection to the was40 database:
- Log in as the DB2 instance owner (the value that you accepted or designated
for the User Name option in Step 9 in the procedure in
the section "Creating a database instance and administration server").
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.
- To ensure that the DB2 environment has been set up correctly, search the environment
for the value of the DB2INSTANCE environment variable by entering the following command. The value returned
must be the instance owner name (the value that you accepted or designated for
the User Name option in Step 9 in the procedure in the
section "Creating a database instance and administration server"):
$ env | grep DB2INSTANCE
- Ensure that DB2 is running or start it by entering the following command:
$ db2start
- Connect to the
was40 database by entering the following command:
$ db2 connect to was40
Your output appears like the following (assuming an instance name of db2inst1):
Database Connection Information
Database server = DB2/HPUX 7.2.1
SQL authorization ID = DB2INST1
Local database alias = WAS40
- If you want to stop DB2, enter the following command:
$ db2stop
- To log out as the DB2 instance owner, enter the following command:
$ exit
The DB2 server remains active unless you stop it as detailed in Step 6.
Configuring WebSphere Application Server when dropping and reinstalling the was40 administrative database
If you drop and recreate the was40 database after you have installed and successfully started
the WebSphere Application Server administrative server for the first time, you must reset the
values of the com.ibm.ejs.sm.adminServer.createTables flag and the install.initial.config flag.
These flags are found in the WebSphere Application Server admin.config file, which is located by default
in the directory /opt/WebSphere/AppServer/bin.
You must reset the values of these flags because the WebSphere Application Server product
automatically changes their values from true to false when
the administration server is started successfully for the first time. The product changes the values of these flags
so that the creation of the database tables and installation of the Default Server and sample applications are not repeated
with subsequent starts of the administration server.
Perform the following steps to drop, recreate, and set the application heap size for the was40 database
and to change the values for the com.ibm.ejs.sm.adminServer.createTables and install.initial.config flags:
- 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 and administration server").
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 DB2 is running or start it by entering the following command:
$ db2start
- Drop, recreate, and set the application heap size for the
was40 database by entering the following commands:
$ db2 drop database was40
$ db2 create database was40
$ db2 update db config for WAS40 using applheapsz 256
- In order for your changes to take effect, you must start and stop DB2.
To do this, enter the following commands:
$ db2stop
$ db2start
If an application heap size of 256 does not work for your
system, increase the size to 512.
- Log out as the DB2 instance owner by entering the following command:
$ exit
The DB2 server remains active unless you stop it by using the db2stop command.
- As user root, open the admin.config file in a text editor.
- Change the value for the com.ibm.ejs.sm.adminServer.createTables flag from
false to true .
- Change the value for the install.initial.config flag from
false to true .
- Save the edited admin.config file.
|
|