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.
In the following sections, we'll look at WebDB's PL/SQL gateway and its integrated HTTP listener.
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
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).
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.
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.
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 ;
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.
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:
Log requests using standard NCSA format
Log requests using extended NCSA format
Log requests using NCSA format, including extended error information
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:
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.,
to files with the
extension). You can extend these defaults with your own mappings (e.g.,
to files with the
extension). Mappings are made using multiple name/value pairs consisting of:
; [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.
Copyright (c) 2000 O'Reilly & Associates. All rights reserved.