To build the Online Auction sample application, you need to ensure that all
system prerequisites are met and that the development and run-time
environments are correctly installed and configured.
The hardware and operating system prerequisites for building and running
the Online Auction sample application are the same as those that are specified
for the WebSphere Studio product. This scenario was originally
developed for WebSphere Studio Application Developer and has been updated to
incorporate the Unified Modeling Language visualization capabilities for EJBs
and for Java. The instructions
provided here should work for other WebSphere Studio product configurations
that include the EJB tools.
In addition to WebSphere Studio and its prerequisites, you need the
following software in order to build and run the Online Auction sample
application :
- DB2 Universal Database(TM) (UDB) for Windows(R) Version 7.2
(included in the WebSphere Studio box). DB2(R) is included with
most configurations of the WebSphere Studio product family. If DB2 was
not included in your WebSphere Studio package, you can download it from www.ibm.com/software/data/db2.
- DB2 Universal Database (UDB) for Linux Version 7.2 (included in the
WebSphere Studio box).
The optional software is as follows:
In preparation for building and running the Online Auction sample
application, you need to perform the following activities, which are described
in the sections that follow.
- Install and configure the CVS server (optional).
- Install and configure WebSphere Studio as your development environment
(required).
- Install DB2 and run the DB2 script to create the database tables
(required).
In this section, you get some tips on how to install the CVS server and set
up the repository for team development. The installation of CVS is
optional for the sample application, but there are sections in the sample
application instructions that explain how to use it with WebSphere Studio for
team programming. You can download a free copy of CVS from www.cvshome.org.
To install and configure the CVS server:
- Install the CVS product using the product ZIP file. If you are
planning to use it for production purposes, it is recommended that you install
the product on a Linux server.
- Add the repository (or repositories) by creating a directory and running
the cvs init command.
- Authorize the users. It is recommended that you use an SSH
connection method and create a user ID on the server for each
developer.
- Configure the server to run the SSH daemon by default.
More detailed information about installing, configuring, and using the CVS
server can be found in the CVS manual and
in articles located on the WebSphere
Developer Domain.
Install WebSphere Studio using the installation instructions that accompany
the product.
In this section, you perform the following activities:
- Launch WebSphere Studio
- Customize the J2EE perspective to include the UML class diagrams on the File
> New submenu
To customize the J2EE perspective to include UML class diagrams on the File
> New submenu
- Open the J2EE perspective (if it isn't opened already)
- Select Window > Customize Perspective
- Expand the File > New item
- Check the Class Diagram checkbox
- Click OK
In this section, you perform the following activities:
- Install DB2 (if not already installed).
- Change your DB2 installation to use the JDBC 2.0 driver.
- Run the mandatory DB2 script, which creates an auction database named
dreamauc as an alias of the SAMPLE database. The script also creates
two tables in the dreamauc database that are named ejb.OnlineItem and
ejb.NameValue.
WebSphere Studio includes a copy of DB2 UDB Personal Edition. You
can also download a free copy of DB2 UDB Personal Edition from www.ibm.com/software/data/db2.
To enable the JDBC 2.0 driver and create the database:
-
If DB2 is not already installed, install it by running the DB2 installation
program.
Run the DB2 install program and select the Create a DB2 instance
option, then accept the default user name db2inst1 and accept all remaining
default values in the install program.
-
Login as user db2inst1 by issuing the following command: su -
db2inst1
- Change your DB2 installation to use JDBC 2.0 by completing the
following steps:
- Open a DB2 command window (Start > Programs > IBM DB2 >
Command Window), then navigate to
DB2_installdir\SQLLIB\java12 (where DB2_installdir is
the installation path of DB2).
- Stop all DB2 services and make a note of the services you stopped, then
run the following command to change your database installation to use JDBC
2.0: usejdbc2.bat
- Restart the services that you stopped, then in a DB2 command window, issue
the following command to ensure the essential DB2 processes are running:
db2start.
- Navigate to the following directory: /home/db2inst1
- Edit the file .bashrc and add the following lines of code to the
bottom of the file:
if [ -f /home/db2inst1/sqllib/java12/usejdbc2 ]; then
. /home/db2inst1/sqllib/java12/usejdbc2
fi
- Save and close the file.
- Issue the following command: source
./.bashrc
- Create the DB2 UDB SAMPLE database (if not already created) by completing
the following steps:
- Select Start > Programs > IBM DB2 > First
Steps.
- Click Create Sample Databases.
- Select the DB2 UDB Sample check box and click
OK. (Note that if you created the sample database
previously, the check box will be cleared.)
- When a message box indicates that the database has been created, click
OK and close the First Steps wizard.
- If you would rather create a new database than use the DB2 UDB Sample
database, then edit the crtOnlineItems.sql script and follow the
instructions in the comment sections.
- In a DB2 command window, navigate to the following directory (where
WS_installdir is the path where you have installed WebSphere
Studio): WS_installdir\samples\scenario_parts\auction
- In a DB2 command window, run the script by issuing the following
command: db2 -tf crtOnlineItems.sql This creates the
required tables and populates them with some test data.
- Close the DB2 command window.
- Issue the following command: db2sampl
- In the command window, navigate to the following directory:
/opt/IBM/WebSphereStudio/samples/scenario_parts/auction
- If you would rather create a new database than use the DB2 UDB Sample
database, then edit the crtOnlineItems.sql script and follow the
instructions in the comment sections.
- In a command window, run the script by issuing the following
command: db2 -tf crtOnlineItems.sql This creates the
required tables and populates them with some test data.
-
Complete the following steps:
- Exit from user db2inst1.
- To ensure that the correct database libraries are accessible, complete the
following steps:
- Navigate to the home directory. For example:
/home/user_name
- Edit the file .bashrc and add the following lines of code to the
bottom of the file:
if [ -f /home/db2inst1/sqllib/db2profile ]; then
. /home/db2inst1/sqllib/db2profile
fi
if [ -f /home/db2inst1/sqllib/java12/usejdbc2 ]; then
. /home/db2inst1/sqllib/java12/usejdbc2
fi
- Save and close the file.
- Issue the following command from the home directory: source
./.bashrc
- Exit from WebSphere Studio and then open WebSphere Studio again to pick up
the environment changes.