Home > Articles > Web Services > WebSphere

  • Print
  • + Share This
This chapter is from the book

Tutorial Setup

To prepare the environment for the tutorial, you will create a deployment configuration in WebSphere Portlet Factory, create a database and a table in DB2, and create a datasource in WebSphere Application Server.

WebSphere Portlet Factory—Create a Deployment Configuration

A deployment configuration is a set of properties that define your deployment information. An application server is needed for testing the models in the tutorial and you will create a deployment configuration for the application server instance. Your WebSphere Portal installation has two WebSphere Applications Server instances: server1 and WebSphere_Portal. In this section, you will create a deployment configuration for the WebSphere Application Server instance WebSphere_Portal.

  1. Start WebSphere Portlet Factory Designer.
    1. Click Start, All Programs, IBM WebSphere, Portlet Factory, Designer.
    2. Click OK to accept the default workspace folder as shown in Figure 7.4.
    Figure 7.4

    Figure 7.4 Select a workspace

  2. Create a deployment configuration.
    1. Click Window, Preferences as shown in Figure 7.5.
      Figure 7.5

      Figure 7.5 Set preferences

    2. Expand the WebSphere Portlet Factory Designer section and click Deployment as shown in Figure 7.6.
      Figure 7.6

      Figure 7.6 Select deployment preferences

    3. Click Add to create the deployment environment for deploying your projects as shown in Figure 7.7.
      Figure 7.7

      Figure 7.7 Add a deployment configuration

    4. Table 7.1 shows you how to provide inputs for the New Deployment Configuration dialog. Click OK when you are finished with the dialog as shown in Figure 7.8. Make sure the WAS server WebSphere_Portal has been started.

      Table 7.1. Input values for Deployment Configuration dialog



      Configuration Name

      Enter WAS61 or provide a different name of your choice.


      Enter WAS 6.1 deployment configuration or provide your own description.

      Server Type

      Select WebSphere Application Server 6.x from the drop-down.

      Installed Applications Dir

      Enter your WebSphere Portal installed directory.

      (Example: C:\IBM\WebSphere\wp_profile\installedApps\portalhost).

      Server Host

      Enter your WebSphere Portal host name.

      (Example: portalhost.ibm.com).

      Server Port


      Specify Deployment Credentials

      Select this check box.

      WAS Server for deployment

      Select WebSphere_Portal from the drop-down.

      Admin User

      Enter your WebSphere Portal Administrator user ID.

      Admin Password

      Enter your WebSphere Portal Administrator password.

      Figure 7.8

      Figure 7.8 New Deployment Configuration dialog

    5. A message indicating that the test to connect to the WAS server was successful is shown as in Figure 7.9. Click OK to close the window.
      Figure 7.9

      Figure 7.9 Test connection message

    6. The new deployment configuration has been created successfully as shown in Figure 7.10. Click OK to close the Preferences window.
      Figure 7.10

      Figure 7.10 New deployment configuration successfully created

In this setup step, you have created a deployment configuration for deploying your projects.

DB2—Create a Database and a Table

This is a setup step required by Tutorial 7.2.

  1. Start the DB2 Control Center.
    1. Click Start, All Programs, IBM DB2, DB2COPY1 (Default), General Administration Tools, Control Center.
    2. Advanced view is the default for the Control Center View as shown in Figure 7.11. Simply click OK.
    Figure 7.11

    Figure 7.11 Specify Control Center view

  2. Create a database using the Create Database Wizard.
    1. Right-click All Databases and click Create Database, Standard as shown in Figure 7.12.
      Figure 7.12

      Figure 7.12 Invoke Create Database Wizard

    2. Enter PetDB as the database name, and keep all other defaults as shown in Figure 7.13. Click Finish.
      Figure 7.13

      Figure 7.13 Specify database name

  3. Create a database table using the Create Table Wizard.
    1. After database PetDB is created successfully, you are returned to the Object view. You should be able to see PetDB by expanding All Databases. To invoke the Create Table Wizard, expand PetDB. Then right-click Tables and click Create as shown in Figure 7.14.
      Figure 7.14

      Figure 7.14 Invoke Create Table Wizard

    2. Enter PetTravelCompany as the table name as shown in Figure 7.15. Click Next.
      Figure 7.15

      Figure 7.15 Specify table name

    3. Click Add to add a column to the PetTravelCompany table as shown in Figure 7.16.
      Figure 7.16

      Figure 7.16 Add a column

    4. Enter ID as the column name and select INTEGER from the drop-down for data type as shown in Figure 7.17. Click OK.
      Figure 7.17

      Figure 7.17 Add Column dialog

    5. Use the Add button to add two more columns using the Table 7.2 as inputs.

      Table 7.2. Inputs values for add column dialog

      Column Name

      Data Type








    6. PetTravelCompany has three columns added as shown in Figure 7.18. Click Finish.
      Figure 7.18

      Figure 7.18 Column definition

    7. A message indicating that the table creation was successful is shown as in Figure 7.19. Click Close.
      Figure 7.19

      Figure 7.19 Table successfully created

    8. To display the list of tables in the Contents pane, right-click Tables and click Refresh as shown in Figure 7.20. Do you see your newly created table PetTravelCompany in the Contents pane on the right side?
      Figure 7.20

      Figure 7.20 Refresh the list of tables

  4. Add data to a database table.
    1. To add data to the table PetTravelCompany, right-click PETTRAVELCOMPANY and click Open. as shown in Figure 7.21
      Figure 7.21

      Figure 7.21 Open a table

    2. Click Add Row to add a row to the table as shown in Figure 7.22. You will be doing this action four times to add four rows.
      Figure 7.22

      Figure 7.22 Add a row

    3. Use table 7.3 as input when adding the four rows to the table.

      Table 7.3. Input values for Add Rows






      Pet travel insurance



      Pet carrier for dogs



      Pet friendly accommodation



      Pet sitting while you travel

    4. When all the rows have been added to the table, click Commit and then Close as shown in Figure 7.23.
Figure 7.23

Figure 7.23 Table content

In this setup step, you have created a database and a table for creating a portlet that accesses a database.

WebSphere Application Server—Create a Datasource

This is a setup step required by Tutorial 7.2.

  1. Log in to WebSphere Application Server administration console.
    1. Start the WebSphere Application Server administration console by opening a browser and entering the uniform resource locator (URL) http://<hostname>:<port_number>/ibm/console, where <hostname> is the fully qualified host name of the machine that is running your WebSphere Portal and <port_number> is the administration console port number. For example, enter http://portalhost.ibm.com:10027/ibm/console
    2. Log in using your administrator user ID and password.
  2. Select the JDBC (Java Database Connectivity) provider.
    1. Expand Resources, JDBC and click JDBC Providers as shown in Figure 7.24.
      Figure 7.24

      Figure 7.24 Go to the list of JDBC providers

    2. Click wpdbJDBC_db2 as shown in Figure 7.25.
    Figure 7.25

    Figure 7.25 Select the JDBC provider for the portal

  3. Create a datasource.

    1. Under Additional Properties, click Data Sources as shown in Figure 7.26.
      Figure 7.26

      Figure 7.26 Go to the list of datasources

    2. To invoke the Create a Data Source Wizard, click New as shown in Figure 7.27. You will be creating a datasource for your database PetDB.
      Figure 7.27

      Figure 7.27 Invoke the Create a New Data Source Wizard

    3. In Step 1 of the Create a Data Source Wizard as shown in Figure 7.28, enter PetDB for the datasource name, jdbc/PetDB for the JNDI name, and select wpdbDSJAASAuth for the authentication alias. Click Next.
      Figure 7.28

      Figure 7.28 Step 1 of the Create a Data Source Wizard

    4. In Step 2 of the Create a Data Source Wizard as shown in Figure 7.29, enter PetDB for the database name and your WebSphere Portal host name for the server name. An example of a host name is portalhost.ibm.com. Click Next.
      Figure 7.29

      Figure 7.29 Step 2 of the Create a Data Source Wizard

    5. In Step 3 of the Create a Data Source Wizard as shown in Figure 7.30, simply review the information. Click Finish.
      Figure 7.30

      Figure 7.30 Step 3 of the Create a Data Source Wizard

    6. Click the Save Directly to the Master Configuration link as shown in Figure 7.31.
      Figure 7.31

      Figure 7.31 Save to master configuration

    In this setup step, you created a datasource for database PetDB.

  • + Share This
  • 🔖 Save To Your Account