EGL Pizza on the Web setup instructions

The Pizza on the Web program lets you interact with a DB2 or Informix database (EGLSAMP) by way of a Web browser. The database resides on the Web Application Server and is accessed by the JNDI name jdbc/EGLSAMP.

You may run the Pizza on the Web application using either a WebSphere v5.x Test Environment server or a WebSphere v6 server. If you want to use a v5.x server you must have previously installed the WebSphere test environment v5.x feature. By default the sample is set up to run using a v6 server. To use a v5.x server you must take the following steps when you import the sample and the first page of the new sample wizard is displayed:

  1. Click the Hide Advanced button
  2. From the Servlet Version dropdown list select 2.3
  3. From the Target Server dropdown list select WebSphere Application Server V5.1

After you have imported the sample, do as follows to set up a test server (which accesses the database) and to run the sample programs:

  1. Expand the project and the EGLSource directory to see the EGL files used in the sample
  2. Expand the WebContent folder to see the Java Server Faces JSP files used in the sample
  3. Create a database named EGLSAMP:
    1. If you are using a DB2 database, use DB2 facilities to create the database. If you are using DB2 V8.1, you can use the Control Center to create the database; enter the database name and accept all defaults. To use the v6 server, the minimum DB2 version required is V8.1.6
    2. If you are using an Informix IDS database, use dbaccess or the Informix Server Administrator to create the database. Set the logging mode of the database to ANSI-compliant unbuffered logging.

  4. Configure a web server with a data source to access the EGLSAMP database. The instructions for configuring a data source are dependent on the application server version and the database manager being used.

    For the v5.1 Test Environment server

    1. Open the Web perspective (Select Window->Open Perspective-> Web ).
    2. Click on the Servers view tab
    3. Right click within the Servers view, select New->Server
    4. On the Define a New Server dialog select server type WebSphere v5.1 Test Environment
    5. Press Next and press Next on the following dialog
    6. On the Add and Remove Projects dialog, select project EGLPizzaOnTheWebEAR
    7. Press Add, then press Finish
    8. Right click on the new server entry in the Servers View and select Open.
    9. Configure the data source

      If you are using a DB2 database

      1. Select the Data source tab.
      2. Select Default DB2 JDBC provider in JDBC provider list and press the SECOND Add button (the one next to table titled Data source defined in the JDBC provider selected above.)
      3. Select DB2 JDBC Provider and press next.
      4. Change JNDI Name to jdbc/EGLSAMP and press next
      5. Select databaseName, change value to EGLSAMP, and press finish.

      If you are using an Informix IDS database

      1. Select the Security tab. Click Add
      2. In the Alias text box, enter an arbitrary name for the entry. In the User ID and Password text boxes, enter the User ID and password used to login to the instance of IDS that contains EGLSAMP. Entering a description in the Description text box is optional. Click Ok
      3. Select the Data source tab.
      4. Highlight each entry in the JDBC provider list and click remove. There should be no entries in the list. Click Add.
      5. In the Database type list box of the Create a JDBC Provider screen, select Informix. In the JDBC provider type list box, select Informix JDBC Driver. Click Next.
      6. In the Name text box, type a name for the data source. Click Add External JARs.
      7. In the Select JAR file window, browse to the installed location of your Informix JDBC Driver.
      8. Double-click the /lib folder and select ifxjdbc.jar. Click Open.
      9. In the Create a JDBC Provider window, click Add External JARs.
      10. In the Select JAR file window, browse to the installed location of your Informix JDBC Driver.
      11. Double-click the /lib folder and select ifxjdbcx.jar. In the Create a JDBC Provider window, click Finish.
      12. In the table labeled JDBC provided list, select the newly-created JDBC provider. Click the Add button that is across from the table labeled Data source defined in the JDBC provided selected above ( second one from the top ).
      13. In the Select the type of JDBC provided window, select Informix JDBC Driver. Click Next.
      14. In the Name text box, change the name to EGLSAMP.
      15. In the JNDI name text box, change the name to jdbc/EGLSAMP.
      16. In the Component-managed authentication alias drop down list, select the JAAS authentication entry created earlier. Click Next.
      17. Select databaseName, enter EGLSAMP. Enter the appropriate values for serverName, portNumber, and ifxIFXHOST. Click Finish.
    10. Close and save the server definition.
    11. Right click on server definition and select publish.

    For the v6.0 Application server

    1. Open the Web perspective (Select Window->Open Perspective-> Web ).
    2. Click on the Servers view tab
    3. If there is not already a v6 server defined
      1. Right click within the Servers view, select New->Server
      2. On the Define a New Server dialog select server type WebSphere v6.0 Server
      3. Press Next and press Next on the following dialog
      4. On the Add and Remove Projects dialog, select project EGLPizzaOnTheWebEAR
      5. Press Add, then press Finish
    4. Right click on the v6 server entry in the Servers View and select Start. Wait until the server status changes to Starting, then to Started
    5. Right click on the started v6.0 server and select Run administrative console
    6. On the Welcome page, enter a user ID and select Log in
    7. Expand the Security node on the left and select Global security
    8. Under Authentication, expand JAAS Configuration and then select J2C Authentication Data
    9. Select New
    10. Enter an Alias, for example, EGLSAMPUser
    11. Enter a User ID that can access the EGLSAMP database
    12. Enter a password for the user ID
    13. Select Apply
    14. Configure the data source

      If you are using a DB2 database

      1. Expand the Environment node on the left and select WebSphere Variables
      2. Select the Server scope radio button
      3. In the variable list select the variable DB2UNIVERSAL_JDBC_DRIVER_PATH
      4. In the value field enter the directory containing the DB2 JDBC drivers. By default this is C:\Program Files\IBM\SQLLIB\java on a Windows system
      5. Select Apply
      6. Expand the Resouces node on the left and select JDBC Providers
      7. Select the Server scope radio button
      8. Select New above the Providers list, which may be empty
      9. On the JDBC Providers page, for Step 1 select DB2. For Step 2 select DB2 Universal JDBC Driver Provider, and for Step 3 select Connection pool data source.
      10. Select Next
      11. On the General Properties page, select Apply
      12. Under Additional Properties, select Data sources
      13. On the data sources page select New
      14. Under General Properties, enter JNDI name jdbc/EGLSAMP
      15. For database name enter EGLSAMP
      16. For Server name enter localhost if the database server is local to your machine, or the database server otherwise
      17. If your database server is not using the default port of 50000, enter the port
      18. Under the Component-Managed Authentication alias drop down symbol, select the alias created above to access the EGLSAMP database
      19. Select Apply
      20. In the Messages box at the top of the JDBC providers box select the save link
      21. Select Save

      If you are using an Informix database

      1. Expand the Environment node on the left and select WebSphere Variables
      2. Select the Server scope radio button
      3. In the variable list select the variable INFORMIX_JDBC_DRIVER_PATH
      4. Select the Properties view and in the value field enter the directory containing the Informix JDBC drivers. The jar file names expected to be in the directory by the v6 server are ifxjdbc.jar and ifxjdbcx.jar
      5. Select Apply
      6. Expand the Resources node on the left and select JDBC Providers
      7. Select the Server scope radio button
      8. Select New above the Providers list, which may be empty
      9. On the JDBC Providers page, for Step 1 select Informix. For Step 2 select Informix JDBC Driver Provider, and For Step 3 select Connection pool data source.
      10. Select Next
      11. On the General Properties page, select Apply
      12. Under Additional Properties, select Data sources
      13. On the data sources page select New
      14. Under General Properties, enter JNDI name jdbc/EGLSAMP
      15. For database name enter EGLSAMP
      16. Enter the name of your Informix Server
      17. In the ifxIFXHOST field enter the location of your Informix database server
      18. If your database server is not using the default port of 1526, enter the port
      19. Under the Component-Managed Authentication alias drop down symbol, select the alias created above to access the EGLSAMP database
      20. Select Apply
      21. In the Messages box at the top of the JDBC providers box select the save link
      22. Select Save
    15. EGL page handler parts are automatically generated when saved.

      Note: When you loaded this sample, the page handlers were generated. Non-page handler parts are not generated automatically on save. This is another good reason to keep your page handlers small and to call program or library parts to do the detailed work. Pre-generated Java files were included in the sample when it was loaded to avoid unresolved references from the page handlers to these other parts. However, those parts must be generated to put information on how to access the EGLSAMP database into the Pizza application's deployment descriptor.

      To generate the non-page handler parts, do as follows:

      1. In the EGLSource/createTables folder, right-click on the file CreatePizzaTables.egl and select Generate.
      2. In the EGLSource/data folder, right-click on the file CustomerLib3.egl and select Generate.

    16. To start the Pizza sample, right-click on PizzaIntroduction.jsp in the WebContent folder and select Run on server. Select the server you just configured and press Finish.