Skip to main content

skip to main content

developerWorks  >  Information Management | XML | SOA and Web services  >

Build a pureXML application in DB2 for z/OS, Part 2: Web enablement through Universal Services

developerWorks
Go to the previous pagePage 4 of 11 Go to the next page

Document options
PDF format - Fits A4 and Letter

PDF - Fits A4 and Letter
3455 KB (48 pages)

Get Adobe® Reader®

Discuss

Sample code


My developerWorks needs you!

Connect to your technical community


Rate this tutorial

Help us improve this content


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.

  1. Log on with the username and password provided at installation time:

    Figure 4. WebSphere Application Server administrative console
    Screenshot of the Websphere Application Server administrative console

  2. From the menu on the left, choose Resources > JDBC > JDBC Providers:

    Figure 5. JDBC Providers
    Screenshot showing how to select JDBC Providers

  3. Click on New:

    Figure 6. Create new JDBC provider
    Screenshot showing how to create a new JDBC provider

  4. 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
    Screenshot showing how to create a new JDBC provider, step 1

  5. 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
    Screenshot showing how to create a new JDBC provider, step 2

  6. You get a summary page with the definitions made. Click on Finish:

    Figure 9. Create JDBC provider, step 3
    Screenshot showing how to create a new JDBC provider, step 3

  7. Finally, to save the changes to the master configuration click on Save:

    Figure 10. Create JDBC provider, step 4
    Screenshot showing how to create a new JDBC provider, step 4

The new JDBC provider is now available for use:


Figure 11. The new JDBC provider is created
Screenshot showing the new JDBC provider is created

The second task is to configure the data source:

  1. Choose Resources > JDBC > Data Sources from the menu on the left, then click on New:

    Figure 12. Create new data source
    Screenshot showing how to create new data source

  2. 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
    Screenshot showing how to create J2C authentication alias, step 1

  3. Click on New:

    Figure 14. Create J2C authentication alias, step 2
    Screenshot showing how to create J2C authentication alias, step 2

  4. 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
    Screenshot showing how to create J2C authentication alias, step 3

  5. Click on Save directly to the master configuration:

    Figure 16. Create J2C authentication alias, step 4
    Screenshot showing how to create J2C authentication alias, step 4

Now you must configure the data source:

  1. Choose Resources > JDBC > Data Sources, and click on New:

    Figure 17. Create data source, step 1
    Screenshot showing how to create data source, step 1

  2. 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
    Screenshot showing how to create data source, step 2

  3. 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
    Screenshot showing how to create data source, step 3

  4. 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
    Screenshot showing how to create data source, step 4

  5. Click on Finish on the summary page, then click on Save directly to master configuration:

    Figure 21. Create data source, step 5
    Screenshot showing how to create data source, step 5

  6. 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
    Screenshot showing how to create data source, step 6

    The following receipt shows that the test was successful:



    Figure 23. Create data source, step 7
    Screenshot showing how to create data source, step 7

You are now ready to deploy the .war file.

  1. Select Application > Install New Applications from the menu on the left.
  2. Fill in the path to the .war file or use the browse function to locate it.
  3. Enter UniversalServices (no spaces) for the "Context root" field, and click on Next:

    Figure 24. Deploy WAR file, step 1
    Screenshot showing how to deploy WAR file, step 1

  4. Accept the default values, scroll down to the bottom, and click on Next:

    Figure 25. Deploy WAR file, step 2
    Screenshot showing how to deploy WAR file, step 2

  5. Accept the default values, and click on Next":

    Figure 26. Deploy WAR file, step 3
    Screenshot showing how to deploy WAR file, step 3

  6. Browse to the bottom of the page and select the Universal Services check box.
  7. 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
    Screenshot showing how to deploy WAR file, step 4

  8. Click on Next:

    Figure 28. Deploy WAR file, step 5
    Screenshot showing how to deploy WAR file, step 5

  9. 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
    Screenshot showing how to deploy WAR file, step 6

  10. Finally, click on Applications > Enterprise Applications in the menu on the left.
  11. 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
    Screenshot showing how to 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.



Back to top


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.

  1. Log on with username and password provided at installation time:

    Figure 31. WebSphere Application Server Community Edition administrative console
    Screenshot showing the Websphere Application Server Community Edition administrative console

  2. Select Services > Repository from the menu on the left:

    Figure 32. Adding DB2 Connect license to the repository, step 1
    Screenshot showing how to add DB2 Connect license to the repository, step 1

  3. 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.
  4. 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
    Screenshot showing how to add DB2 Connect license to the repository, step 2

  5. 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.
  6. Select Using the Geronimo database pool wizard:

    Figure 34. Create database pool, step 1
    Create database pool, step 1

  7. 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
    Create database pool, step 2

  8. 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
    Screenshot showing how to add DB2 Connect license to the repository, step 3

  9. 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
    Screenshot showing how to add DB2 Connect license to the repository, step 4

  10. To test the connection, scroll down to "Run SQL".
  11. 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
    Screenshot showing how to test database pool

Now you are ready to deploy the .war file.

  1. Choose Deploy New from the Application area of the menu on the left:

    Figure 39. Deploy WAR file, step 1
    Screenshot showing how to deploy WAR file, step 1

  2. Enter the location of the .war file or use the browse function to find it. It is located in Universal Services/war/wasce.
  3. Click on Install.

    Figure 40. Deploy WAR file, step 2
    Screenshot showing how to 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
Screenshot showing how to deploy WAR file, step 3


Back to top


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
Screenshot of 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:

  1. 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
    Screenshot showing the Apache Tomcat Manager start page

  2. Scroll down to the bottom of the page to the "Select WAR file to upload" field.
  3. 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
    Screenshot showing the deployment of .war file

"Universal Services" is now listed under "Applications":


Figure 45. Universal Services added to Applications
Screenshot showing that the Universal Services is added to Applications

The application has been started successfully, and you are ready to start testing.



Back to top



Go to the previous pagePage 4 of 11 Go to the next page