EGL Pizza On The Web Readme
The pizza sample program uses web pages to interact with the user and an IBM DB2 or
an IBM Informix IDS database named EGLSAMP to store persistent data. It expects to
access the database on the Web Application Server using a JNDI name of jdbc/EGLSAMP.
You will need to perform the following steps to set up a test server to access the
database and run the sample programs.
- Expand the project and the EGLSource to see the EGL files used in the sample
- Expand the WebContent folder to see the Java Server Faces JSP files used in the sample
- Create a database named EGLSAMP
-
If you are using a DB2 database, use DB2 facilities to create the database.
A version of 8.1.6 or later is required if you use a v6.0 application server.
If you are using DB2 V8.1 or later you can use the Control Center to create the database,
taking all defaults after entering the database name.
-
If you are using an Informix IDS database create the database named EGLSAMP
using dbaccess or Informix Server Administrator. Set the logging mode of the
database to ANSI-compliant unbuffered logging.
-
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
- Open the Web perspective (Select Window->Open Perspective-> Web ).
- Click on the Servers view tab
- Right click within the Servers view, select New->Server
- On the Define a New Server dialog select server type WebSphere v5.1 Test Environment
- Press Next and press Next on the following dialog
- On the Add and Remove Projects dialog, select project EGLPizzaOnTheWebEAR
- Press Add, then press Finish
- Right click on the new server entry in the Servers View and select Open.
- Configure the data source
If you are using a DB2 database
- Select the Data source tab.
-
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.)
- Select DB2 JDBC Provider and press next.
- Change JNDI Name to jdbc/EGLSAMP and press next
- Select databaseName, change value to EGLSAMP, and press finish.
If you are using an Informix IDS database
- Select the Security tab. Click Add
- 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
- Select the Data source tab.
- Highlight each entry in the JDBC provider list and click remove. There
should be no entries in the list. Click Add.
- 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.
- In the Name text box, type a name for the data source. Click Add
External JARs.
- In the Select JAR file window, browse to the installed location of your
Informix JDBC Driver.
- Double-click the /lib folder and select ifxjdbc.jar. Click Open.
- In the Create a JDBC Provider window, click Add External JARs.
- In the Select JAR file window, browse to the installed location of your
Informix JDBC Driver.
- Double-click the /lib folder and select ifxjdbcx.jar. In the Create a
JDBC Provider window, click Finish.
- 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 ).
- In the Select the type of JDBC provided window, select Informix JDBC
Driver. Click Next.
- In the Name text box, change the name to EGLSAMP.
- In the JNDI name text box, change the name to jdbc/EGLSAMP.
- In the Component-managed authentication alias drop down list, select
the JAAS authentication entry created earlier. Click Next.
- Select databaseName, enter EGLSAMP. Enter the appropriate values for
serverName, portNumber, and ifxIFXHOST. Click Finish.
- Close and save the server definition.
- Right click on server definition and select publish.
For the v6.0 Application server
- Open the Web perspective (Select Window->Open Perspective-> Web ).
- Click on the Servers view tab
- If there is not already a v6 server defined
- Right click within the Servers view, select New->Server
- On the Define a New Server dialog select server type WebSphere v6.0 Server
- Press Next and press Next on the following dialog
- On the Add and Remove Projects dialog, select project EGLPizzaOnTheWebEAR
- Press Add, then press Finish
- 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
- Right click on the started v6.0 server and select Run administrative console
- On the Welcome page, enter a user ID and select Log in
- Expand the Security node on the left and select Global security
- Under Authentication, expand JAAS Configuration and then select J2C Authentication Data
- Select New
- Enter an Alias, for example, EGLSAMPUser
- Enter a User ID that can access the EGLSAMP database
- Enter a password for the user ID
- Select Apply
- Configure the data source
If you are using a DB2 database
- Expand the Environment node on the left and select WebSphere Variables
- Select the Server scope radio button
- In the variable list select the variable DB2UNIVERSAL_JDBC_DRIVER_PATH
- 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
- Select Apply
- Expand the Resouces node on the left and select JDBC Providers
- Select the Server scope radio button
- Select New above the Providers list, which may be empty
- 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.
- Select Next
- On the General Properties page, select Apply
- Under Additional Properties, select Data sources
- On the data sources page select New
- Under General Properties, enter JNDI name jdbc/EGLSAMP
- For database name enter EGLSAMP
- For Server name enter localhost if the database server is local
to your machine, or the database server otherwise
- If your database server is not using the default port of 50000,
enter the port
- Under the Component-Managed Authentication alias drop down symbol,
select the alias created above to access the EGLSAMP database
- Select Apply
- In the Messages box at the top of the JDBC providers box select the save link
- Select Save
If you are using an Informix database
- Expand the Environment node on the left and select WebSphere Variables
- Select the Server scope radio button
- In the variable list select the variable INFORMIX_JDBC_DRIVER_PATH
- 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
- Select Apply
- Expand the Resources node on the left and select JDBC Providers
- Select the Server scope radio button
- Select New above the Providers list, which may be empty
- 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.
- Select Next
- On the General Properties page, select Apply
- Under Additional Properties, select Data sources
- On the data sources page select New
- Under General Properties, enter JNDI name jdbc/EGLSAMP
- For database name enter EGLSAMP
- Enter the name of your Informix Server
- In the ifxIFXHOST field enter the location of your Informix database server
- If your database server is not using the default port of 1526,
enter the port
- Under the Component-Managed Authentication alias drop down symbol,
select the alias created above to access the EGLSAMP database
- Select Apply
- In the Messages box at the top of the JDBC providers box select the save link
- Select Save
-
EGL page handler parts are automatically generated when saved. When you loaded this sample,
the page handlers were generated. Non-page handler parts are not automatically generated
on save. This is another good reason to keep your page handlers small and to call program
or library parts to do the "dirty 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
- In the EGLSource/createTables folder, right mouse button click on file
CreatePizzaTables.egl
and select Generate.
- In the EGLSource/data folder, right mouse button click on file
CustomerLib3.egl
and select Generate.
- To start the Pizza sample, right mouse button click on PizzaIntroduction.jsp in the
WebContent folder and select Run on server. Select the server you just configured
and press Finish.