 | Deploying to Web servers
This section contains instructions for deployment for each of the Web
servers supported by the Universal Services: WebSphere Application
Server, WebSphere Application Server Community Edition, and Tomcat.
This tutorial does not go through the actual installation process, but
assume that the software has been installed. WebSphere Application
Server Community Edition and Tomcat are both available for download
free of charge (see the Resources section
for further information).
Deployment using WebSphere Application Server
Let's go through three steps you need to follow to deploy the Universal
Services application to WebSphere Application Server:
- Configure a JDBC provider
- Define a data source (in other words, the DB2 subsystem)
- Deploy the .war file
You perform all three steps from the administrative console, which is
run through a Web browser. The full screen of the WebSphere
Application Server administrative console is shown in
Figure 4, but subsequent screen shots only show
the actual console.
- Log on with the username and password provided at installation
time:
Figure 4.
WebSphere Application Server administrative
console
- From the menu on the left, choose Resources >
JDBC > JDBC Providers:
Figure 5. JDBC
Providers
- Click on New:
Figure 6.
Create new JDBC provider
- Select DB2 for Database Type, DB2 Universal Driver
Provider for Provider type, and XA data source for
Implementation type, then click on Next:
Figure 7.
Create JDBC provider, step 1
- Enter the location of the jar files containing the JDBC driver and
the DB2 Connect license. For a standard installation, this will be
C:\Program Files\IBM\SQLLIB\java. Then click on Next:
Figure 8.
Create JDBC provider, step 2
- You get a summary page with the definitions made. Click on
Finish:
Figure 9.
Create JDBC provider, step 3
- Finally, to save the changes to the master configuration click on
Save:
Figure 10.
Create JDBC provider, step 4
The new JDBC provider is now available for use:
Figure 11. The new
JDBC provider is created
The second task is to configure the data source:
- Choose Resources > JDBC > Data
Sources from the menu on the left, then click on
New:
Figure 12.
Create new data source
- Click on Create a new J2C authentication alias (this is the
definition of the user used to connect to the DB2 subsystem):
Figure 13.
Create J2C authentication alias, step 1
- Click on New:
Figure 14.
Create J2C authentication alias, step 2
- Enter a name for the alias (for example, "UnivServUser"), userid
(for example, "db2admin"), and password for the account that is to
be used for the connection to DB2, and click on OK:
Figure 15.
Create J2C authentication alias, step 3
- Click on Save directly to the master configuration:
Figure 16.
Create J2C authentication alias, step 4
Now you must configure the data source:
- Choose Resources > JDBC > Data
Sources, and click on New:
Figure 17.
Create data source, step 1
- Enter
Universal Services for the data
source name and
jdbc/<location name>
(fill in appropriate value) for the JNDI name, then select
UnivServUser from the drop-down menu and click on
Next:
Figure 18.
Create data source, step 2
- Select Select an existing JDBC provider, and choose DB2
Universal Driver Provider XA from the drop-down menu, then
click Next:
Figure 19.
Create data source, step 3
- Enter your own values in the "Database name", "Server name", and
"Port number" fields for the DB2 subsystem, and click on
Next:
Figure 20.
Create data source, step 4
- Click on Finish on the summary page, then click on Save
directly to master configuration:
Figure 21.
Create data source, step 5
- The Universal Services data source is now available in the list.
To test the connection, select the check box next to the data
source, and click on the Test connection button:
Figure 22.
Create data source, step 6
The following receipt shows that the test was successful:
Figure 23.
Create data source, step 7
You are now ready to deploy the .war file.
- Select Application > Install New Applications
from the menu on the left.
- Fill in the path to the .war file or use the browse function to
locate it.
- Enter
UniversalServices (no spaces) for
the "Context root" field, and click on Next:
Figure 24.
Deploy WAR file, step 1
- Accept the default values, scroll down to the bottom, and click on
Next:
Figure 25.
Deploy WAR file, step 2
- Accept the default values, and click on Next":
Figure 26.
Deploy WAR file, step 3
- Browse to the bottom of the page and select the Universal
Services check box.
- Choose a Target Resource JNDI name by clicking the browse button
and selecting the data source previously configured—with
name "jdbc/<location name>"—then click on
Next:
Figure 27.
Deploy WAR file, step 4
- Click on Next:
Figure 28.
Deploy WAR file, step 5
- Click on Finish on the summary screen, scroll down to the
bottom of the following screen, and click on Save directly to
the master configuration:
Figure 29.
Deploy WAR file, step 6
- Finally, click on Applications > Enterprise
Applications in the menu on the left.
- You get a list of applications installed. Universal Services is
marked as stopped. To start it, select the check box next to
Universal Services and click on the Start button:
Figure 30.
Deploy WAR file, step 7
You should get a receipt that the application has been started
successfully and you are then ready to start testing.
Deployment using WebSphere Application Server Community Edition
Let's go through three steps you need to follow to deploy the Universal
Services application to WebSphere Application Server Community
Edition:
- Make the DB2 Connect license available as a resource
- Define a data source (in other words, the DB2 subsystem)
- Deploy the .war file
All three steps are performed from the administrative console, which is
run through a Web browser. The full screen is shown in Figure 31, but
subsequent screen shots only show the actual console.
- Log on with username and password provided at installation time:
Figure 31.
WebSphere Application Server Community Edition
administrative console
- Select Services > Repository from the menu on
the left:
Figure 32.
Adding DB2 Connect license to the repository, step
1
- Enter the location of the DB2 Connect license or use browse to
find it. It will often be found in C:\Program
Files\IBM\SQLLIB\java. The name of the jar file is
db2jcc_license_cisuz.jar.
- Fill in the Group, Artifact, Version, and Type fields as follows
(shown in Figure 33), then click on Install:
- Group: com.ibm.db2
- Artifact: db2jcc_license_cisuz
- Version: 9.1
- Type: jar
Figure 33.
Adding DB2 Connect license to the repository, step
2
- Having added the license, it is now possible to configure the data
source. Select Services > Database Pools from
the left to obtain the Database Pools window.
- Select Using the Geronimo database pool wizard:
Figure 34.
Create database pool, step 1
- Enter
jdbc/UniversalServices as the
name for the database pool, choose DB2 XA as the database
type, and click on Next:
Figure 35.
Create database pool, step 2
- Fill in the connection information. You need to choose driver and
license jar files, and enter your own values for the Port Number,
User Name, Server Name, Password, and Database Name fields. Leave
everything else to default.
Figure 36.
Create database pool, step 3
- Scroll down to the bottom, and click on Deploy.
You can
now see the database pool in the list:
Figure 37.
Create database pool, step 4
- To test the connection, scroll down to "Run SQL".
- Select the database pool jdbc/UniversalServices from the
drop-down menu, enter an SQL statement, and click on the Run
SQL button. The result of the query is returned at the
bottom of the page:
Figure 38.
Test database pool
Now you are ready to deploy the .war file.
- Choose Deploy New from the Application area of the menu on
the left:
Figure 39.
Deploy WAR file, step 1
- Enter the location of the .war file or use the browse function to
find it. It is located in Universal Services/war/wasce.
- Click on Install.
Figure 40.
Deploy WAR file, step 2
When you get the receipt saying the .war file has been installed, you
are ready to start testing:
Figure 41. Deploy WAR
file, step 3
Deployment using Apache Tomcat
Let's go through three steps you need to follow to deploy the Universal
Services application to Apache Tomcat:
- Install the JDBC driver and license for DB2 Connect
- Define a data source (in other words, the DB2 subsystem)
- Deploy the .war file
To install the JDBC driver and license, you copy the files db2jcc.jar
and db2jcc_license_cisuz.jar to the lib directory of the Tomcat
installation. For a standard DB2 Connect installation, these will be
found in C:\Program Files\IBM\SQLLIB\Java. The location of the lib
directory varies with the version of Tomcat. With Version 5.5, it is
located in \Tomcat 5.5\common\, whereas with Version 6, it is in the
Tomcat root directory.
Figure 42. Tomcat 5.5
directories
You can most easily configure the data source by manually editing the
file server.xml, which is located in the conf directory directly under
Tomcat's root directory.
Add the following entry (Listing 2) to the file. The entry should be
placed within <GlobalNamingResources>.
Listing 2. Connection entry in server.xml
<Resource name="jdbc/DSN9"
type="javax.sql.DataSource"
url="jdbc:db2://9.123.45.678:446/DSN9"
driverClassName="com.ibm.db2.jcc.DB2Driver"
password="*******"
maxActive="4"
maxWait="5000"
maxIdle="2"
username="db2admin"/> |
Note: In Listing 2, "DSN9" is the location name, "9.123.45.678"
is the host name, "446" is the port number, "db2admin" is the userid,
and "*******" is the password for the DB2 connection. You must supply
your own values for these parameters.
To deploy the .war file:
- Start Tomcat and open the Tomcat Manager. You normally do this
through a browser pointing at http://localhost:8080/manager/html,
depending on the port number of your Tomcat server. The full
screen of the Tomcat manager is shown in Figure 43, but subsequent
screen shots only show the actual console (note that this tutorial
uses port no 8888). Log on with username/password provided at
installation time.
Figure 43.
Apache Tomcat Manager start page
- Scroll down to the bottom of the page to the "Select WAR file to
upload" field.
- Enter the path to the .war file or use the browse function to
find it, then click on the Deploy button:
Figure 44.
Deployment of .war file
"Universal Services" is now listed under "Applications":
Figure 45. Universal
Services added to Applications
The application has been started successfully, and you are ready to
start testing.
|  |