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).
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:
The HTTP listener configuration parameters fall into three general categories: server settings, virtual directory mappings, and MIME type 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:
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.,
; [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.