home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

3.2 WebDB Architecture

Because WebDB uses the database's native components, it is a scalable, powerful development tool for building content-driven sites on Oracle. Since it's essentially written in the database's native language, it eliminates the need for cumbersome layers like ODBC or JDBC.

WebDB's dirty little secret is that its wizards are really just PL/SQL code generators that act on normal database objects. When you create a user with WebDB, you are really creating a corresponding database schema, just as you would for any other Oracle user. When you use the table wizard, you are really just filling in the pieces of a CREATE TABLE command. When you build a form, you are really creating a PL/SQL package. The options you enter into these wizards tell WebDB how to create the corresponding database objects.

WebDB is a standalone product that contains everything you need to create a complete application. Two built-in components -- the PL/SQL gateway and the HTTP listener -- make this possible. Figure 3.9 illustrates the relationships among the database objects, UI components, shared components, roles, users, the PL/SQL gateway, and the HTTP listener.

Figure 3.9: The components of WebDB

Figure 3.9

In the following sections, we'll look at WebDB's PL/SQL gateway and its integrated HTTP listener.

3.2.1 The PL/SQL Gateway

Once we've created our WebDB user interface components, we can use the PL/SQL gateway to execute them from the Web. The gateway is situated between the database and the HTTP listener. The HTTP listener forwards a request for a component to the PL/SQL gateway, which executes the procedure and stores its output in a buffer. The HTTP listener then sends the contents of this buffer, which now contains the HTML instructions that create the component, back to the user's browser.

Users call a procedure using a URL that specifies the name of the package (which has the same name as the component), the procedure to execute, and any parameters required by the procedure. The PL/SQL gateway uses this information to call the correct procedure. Each procedure begins with a security check to make sure the user attempting to access the component has the required permissions.

The gateway uses DADs to authenticate web users. A DAD is a unique name included as part of a URL. The appearance of a DAD name in the URL signals the HTTP listener that the URL is requesting a WebDB component. The PL/SQL gateway combines the DAD configuration information with the other parts of the URL -- the package name, procedure name, and parameters -- to execute the requested procedure. The URL syntax is:

http://
webDB_server:port
/
dad_name
/
package.procedure?parm1=foo

3.2.2 Configuring a Database Access Descriptor (DAD)

The DAD configuration information specifies a unique name for the DAD and various other configuration information. Again, the name of the DAD is used in the URL to map to the database schema specified in the DAD. Figure 3.10 shows the WebDB interface used to manage these settings (in this case, WebDB appears in the path section of the URL to the WebDB server).

Figure 3.10: DAD administration in WebDB

Figure 3.10

3.2.2.1 DAD parameters

The DAD parameters are:

Database Access Descriptor Name

The unique DAD name. When it appears in a URL, the DAD name signals the HTTP listener to forward the request to the PL/SQL gateway. This parameter is always required.

Oracle User Name

The Oracle schema that will execute the procedure. If this name is blank, the user is prompted for a username and password.

Oracle Password

The password for the Oracle schema. If this is blank, the user is prompted for authentication information.

Oracle Connect String

The connect string of the database running WebDB. The local database (ORA_SID) is used as the default if the field is left blank.

Maximum Number of Worker Threads

The maximum number of threads the WebDB server will use to process requests.

Keep Database Connection Open between Requests?

If this parameter is set to "yes," the listener keeps the database connection open after the request is finished. The next time the user makes a request from the DAD, the listener can open the connection rather than establishing a new one. This improves performance dramatically, since establishing the initial connection is usually quite time consuming. However, this is not the same as a persistent connection; state information such as the values of PL/SQL variables is lost after the request. If the parameter is set to "No," the connection is closed after each request, resulting in poorer performance.

Default (Home) Page

The default procedure to execute when the URL omits a procedure name.

Document Table

The table used to store files uploaded to WebDB.

Document Access Path

The path element used to retrieve an uploaded file.

Document Access Procedure

The procedure to execute immediately after an uploaded file is retrieved.

TIP: WebDB uses basic authentication , a standard HTTP mechanism in which the user must supply a username and password before accessing the site. The password is transmitted as plain text (unencrypted) across the Web, making it fairly insecure. A second method, digest authentication , is more secure because it encrypts the password before transmission. Unfortunately, while this method is supported in OAS, it is not (at least at the time of this writing) supported in WebDB.

3.2.2.2 Configuration file

The configuration information for the PL/SQL gateway is stored in the file %ORACLE_HOME%/listener/wdbsvr.app . Here's an example configuration file that underlies the entries in Figure 3.10 :

[DAD_WebDB]
;connect_string   = 
;password   = 
;username   = 
default_page   =  WEBDB.home
document_table   =  WEBDB.wwv_document
document_path   =  docs
document_proc   =  WEBDB.wwv_testdoc.process_download
;name_prefix   = 
;always_describe   = 
;after_proc   = 
reuse   =  Yes
connmax   =  4
;

3.2.3 The HTTP Listener

The HTTP listener, the last major component of WebDB, is basically a miniature web server. It has the following characteristics:

  • It supports HTTP 1.0.

  • It can serve static files residing in mapped directories.

  • It supports application-specific MIME type mapping.

  • It is multithreaded to provide increased performance.

  • It is specifically designed to integrate with the Oracle database via PL/SQL applications. Although the listener was added to make WebDB a standalone product, it can be used to develop any PL/SQL toolkit application.

  • It does not currently (as of WebDB version 2.0.5) support HTTP 1.1, SSL, or CGI; Oracle is considering adding support for SSL, CGI, Java(TM) Servlets, Java Server Pages, and XML.

The HTTP listener configuration parameters fall into three general categories: server settings, virtual directory mappings, and MIME type mappings.

3.2.3.1 Server settings

The server settings govern the listener's general behavior. Parameters of note include:

Server Port

The port setting determines the communications port on which WebDB "listens" for incoming requests. The default is 80. If you choose another value, URLs referencing the site must specify this value.

Default Mime Type

The default MIME type returned for types that are not explicitly mapped.

Logging Level

The listener maintains a number of logs that can track requests and errors. There are separate log files for the listener and PL/SQL gateway, as well as for each thread. Log files all end with a .LOG extension; log files for individual threads include the thread number as an index. Values for the logging level include:

None

No logging

Standard

Log requests using standard NCSA format

Extended

Log requests using extended NCSA format

Error

Log requests using NCSA format, including extended error information

3.2.3.2 Virtual directory mappings

The virtual directory mappings allow the listener to return static files by mapping physical directories to aliases used as part of a URL. Mappings are made using multiple name/value pairs consisting of:

Physical directory

The physical directory on the machine running WebDB. Once mapped, all files and subdirectories are accessible from the Web.

Virtual directory

The corresponding alias for the physical directory. This alias is used as part of the URL to refer to a physical directory.

3.2.3.3 MIME type mappings

The MIME type mappings map a specific type of file to a MIME type. The listener is preconfigured with most of the standard mappings (e.g., image/jpeg to files with the .JPG extension). You can extend these defaults with your own mappings (e.g., application/rpt to files with the .RPT extension). Mappings are made using multiple name/value pairs consisting of:

MIME type

The MIME type returned for the specified set of corresponding file extensions.

File extension

The file extensions mapped to the MIME type. These mappings are case sensitive, so you will often find the same extension listed in various ways (e.g., . jpg , . JPG , . jpeg , . JPEG ).

3.2.3.4 Configuration file

The configuration information for the HTTP listener is stored in the file %ORACLE_HOME%/listener/wdbsvr.cfg . The following listing is an example configuration file:

;
[SERVER]
;HomePage = 
DefaultMimeType = application/octet-stream
LoggingLevel = Extended
;MaxFileCache = 
MaxFileThreads = 3
MaxDispatcherThreads = 7
;
[DirMaps]
D:\ORANT\webdb\images\  /images/
;
[MIMETypes]
text/html  htm   html
image/jpeg  jpg   jpeg  JPG
text/plain  txt   ksh   lst
application/pdf  pdf
application/powerpoint  ppt   PPT
application/msword  doc   dot   DOC  DOT
application/x-tar  tar   TAR
application/zip  zip
text/edi  edi
application/excel  xls   XLS
text/xml  xml
;

WebDB is a big product with a huge set of features, and this overview has just scratched the surface of its many capabilities. WebDB comes with several manuals providing step-by-step instructions on configuring and using the product. Additionally, you can consult Rick Greenwald's Oracle WebDB Bible (IDG Books Worldwide) for a thorough treatment of the subject.


Previous: 3.1 Overview of WebDB Oracle Web Applications: PL/SQL Developer's Introduction Next: 4. Oracle Application Server (OAS)
3.1 Overview of WebDB Book Index 4. Oracle Application Server (OAS)

The Oracle Library Navigation

Copyright (c) 2000 O'Reilly & Associates. All rights reserved.

Library Home Oracle PL/SQL Programming, 2nd. Ed. Guide to Oracle 8i Features Oracle Built-in Packages Advanced PL/SQL Programming with Packages Oracle Web Applications Oracle PL/SQL Language Pocket Reference Oracle PL/SQL Built-ins Pocket Reference






??????????????@Mail.ru