Building a Web application using Oracle’s Designer entails some configuration. First, the Apache Web Server has to be installed and configured. To test for its installation, check for the Apache directory under the Oracle Home of your database. On my local machine this is:

The indicated folder is the Apache home: C:\Oracle9iDB\Apache\Apache\htdocs. This is the root directory of the Web Server. Its index.html file is what should appear when the launching the web browser and connecting to this root. (The conf folder under the second Apache folder contains configuration files, the most import of which is httpd.conf. It maps physical directories to virtual ones for browsing purposes.) In order to launch the browser, be sure that the Apache server is running: When you launch the browser, connect to the web home of your web server machine.

This web root, http://joelaptop:7778/, maps to the C:\Oracle9iDB\Apache\Apache\htdocs, and launches the index.html file displayed in the browser. After the standard http:// prefix is the machine name of the web server, here joelaptop, followed by a colon separator, the port number (7778) and the final slash. The Mod_plsql Configuation Menu is the link that you will use to establish a Data Access Descriptor (DAD) that will create a virtual directory for your application and establish a connection to a user’s schema of the targeted Oracle database. Select Gateway DAD settings, and then select Add Default (blank configuration). For this example, I will use SCOTT as the DAD, using scott/tiger@local as the connect information. Choose a DAD of your choice and use your connection information to your account on dev.sba.Oakland.edu. Go to the top of this page, after filling in the DAD name and connectivity information, and select the OK pushbutton. You should see: Now that we have a web server, a virtual directory and database connection configured, we can use Designer’s Module creation capability to generate and install a Web PL/SQL application.

Using the Oracle9i Designer’s Design Editor, chose Module Application with use a guide radio button selected:

Click the OK pushbutton: Select Create and Edit Modules in the context container of your choice (or one that you can create in the usual manner).

Select Modules. The select Create… Keep the Default module type, then enter HELLO for module short name and module name, enter a purpose, and select Web PL/SQL as the Language. Click Next (3 times) until you see the following window:

In the User text box of the Default Area, enter the following text:

Hello World!

The time is htf.nobr(to_char(sysdate, 'yyyy-mm-dd hh24:mi:ss'))

This is standard html for the most part. The htf.nobr is a function call in the htf package that you installed as part of the Install Web PL/SQL generator in an earlier session. The to_char is a standard Oracle function that converts time (coming from the system’s clock in this case to a character string of the indicated format.

Your window should now look something like: Click Next twice and then Finish. Under the Modules folder of the Modules Navigator, you should see the Hello Module. Before generating and installing the Hello module, lets look at and change some of this module’s options. This is where you have a lot of control over how the application is actually generated. To do this, right click the Hello module, selecting Edit Generating Preferences. Change both “About Page Hyperlink” and “Substitute HTML Reserved Characters” to No. The former gets rid of a link that Oracle puts in on the web page by default; while the latter will treat the html tags we entered as text earlier as tags and not raw text.

We are in a position to code generate! Right click the Hello module, selecting Generate… Before jumping the gun, let’s look at some of the generating options! Fill in the options consistently with the DAD that you created earlier. Use the same logon and connect information. Note that you point Designer to where your browser executable resides and that the Web Agent URL is your Apache root followed by pls/DAD/ where my DAD was scott (as opposed to the user scott). Click OK.

Click Start to have coded generation and module installation occur. After clicking OK, in the message window, select the wrench icon.

Select run generated application using browser, and click run. You should see something like: You have written and deployed your first Web application. Congratulations! Note the syntax of the URL: It contains the virtual directory established earlier with the pls/DAD/modulename$.startup tacked on. To better understand the foregoing process, let’s take a look at the installed packages in the scott/tiger schema of my local database. Note that under packages, we can see the logic of the procedure HELLO$. Further detail is available under Package Bodies, the body package also named HELLO$. These packages, in turn, call upon packages and functions installed with the Web PL-SQL Generator.

Although you have accomplished much, this application module is very simple and does not take advantage of the real potential of the Oracle Designer environment. In particular, there was no database interaction at all. In order to build dynamic Web pages that interact with a database, we have to do a bit more. In the following example, I will reverse-engineer the scott/tiger schema using the same techniques used earlier for the BCC03 schema:

This schema has the four tables shown above: Bonus, Dept, Emp, and Salgrade, with some relationships and other constraints. In particular: Let’s create a simple module that lists the employees (from EMP) of the foregoing schema. To create a module, either select module application guide from the Tools menu of the Design Editor, or right-click the Modules folder, selecting create module from the Navigator. Fill in the information as follows: Click Next > until you reach the Goodbye screen: Select the “Create the module then invoke Wizard to create Module Component” radio button, and click Finish. Then fill in the following Window:

Click Next >, then Select the EMP table from the pull-down: Note that it picks up automatically the DEPT table for possible Lookup capability from the relationship (PK-FK) of the captured Schema. In this case click Next > twice. (Do not select DEPT for lookup.) You should see:

Accept these defaults, as we are merely listing employees, not CUDing the EMP table. Note the similarity between this window and the attribute usages of the Function Hierarchy Diagram. Click Next >. Here you can select the columns of the table for the module: Select as follows:

The check boxes indicate with the selected columns will be displayed (or not). Click Next > twice, and change the Query column values to No:

Click Next > several times until you come to the final window of the Wizard: Select the second radio button as above and click Finish. The first window of the Display Wizard appears:

Review the Layout style choices, but keep and click Next > until you reach the Context tab. Fill in the following window as follows after reviewing the choices. Click Finish to end the Display Wizard.

You are now ready to generate the module component. Do so as you did in the HELLO module. You should see:

Choose the Run generated application, and click Run. You should see: Note the general syntax of the URL again. This is similar to before except that you have home/pls/DAD/mod_name$startup. Congratulations! You have now created a dynamic Web page with database interaction, pushbutton controls, and other features.