=========================================================== DOCUMENTATION NOTES FOR Informix Web DataBlade Module Application Developer's Guide AND Informix Web DataBlade Module Administrator's Guide DATE: 26-Apr-2000 ============================================================ TABLE OF CONTENTS I. OVERVIEW OF DOCUMENTATION NOTES II. DYNAMICALLY LOADING THE APACHE WEBDRIVER MODULE III. The "extensions" WEBDRIVER VARIABLE IV. The "schema_version" WEBDRIVER VARIABLE V. CONFIGURING THE DATABLADE MODULE WHEN THE WEB SERVER AND DATABASE SERVER ARE ON DIFFERENT COMPUTERS VI. RETRIEVING INFORMATION ABOUT SERIAL COLUMNS WITH THE MIBLOCK TAG VII. LIMITING LOOP PROCESSING WITH THE MISQL TAG VIII. LIMITING THE NUMBER OF TIMES THE WEBEXPLODE() FUNCTION CAN BE CALLED RECURSIVELY IX. MAXIMUM SIZE OF "max_html_size" WEBDRIVER VARIABLE X. USING VARIABLE-PROCESSING FUNCTIONS IN ATTRIBUTES OF APPPAGE TAGS XI. RETRIEVING LARGE OBJECTS BY THEIR LARGE OBJECT HANDLES XII. EXECUTING AN SQL STATEMENT GREATER THAN 32 KB WITHIN AN MISQL APPPAGE TAG XIII. EXAMPLE OF GENERATING XML-FORMATTED DATA WITH THE WEB DATABLADE MODULE XIV. SETTING DBDATE AND DBCENTURY INFORMIX ENVIRONMENT VARIABLES XV. AUTOMATICALLY CLOSING IDLE WEBDRIVER CONNECTIONS TO THE DATABASE XVI. DOCUMENTATION ERRORS IN THE APPLICATION DEVELOPER'S GUIDE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ I. OVERVIEW OF DOCUMENTATION NOTES ==================================== The purpose of these documentation notes is to make you aware of features not described in the following two guides: o "Informix Web DataBlade Module Application Developer's Guide" o "Informix Web DataBlade Module Administrator's Guide" These notes also describe inaccuracies that might exist in the two guides. II. DYNAMICALLY LOADING THE APACHE WEBDRIVER MODULE ==================================================== Chapter 5 of the "Informix Web DataBlade Module Administrator's Guide" describes how to configure the Apache Webdriver by rebuilding the Apache Web server "httpd" binary. Some customers, however, do not have the Apache source code, or they want to run the default "httpd" binary installed at the time they installed the Apache Web server. To do this, the Apache Webdriver shared object must be dynamically loaded into the Apache "httpd" process at runtime. This section provides instructions on how to update the "httpd.conf" Apache configuration file to be able to dynamically load the Apache Webdriver shared object. A. BEFORE YOU BEGIN --------------------- Before you can dynamically load the Apache Webdriver shared object, you must ensure that your Apache "httpd" binary contains a necessary module. As the owner of the Apache Web server, execute the following command at the operating system prompt to list all the modules that have been linked into your Apache "httpd" binary: httpd -l Ensure that the module "mod_so.c" is in the list. If the "mod_so.c" module is not in the list, you cannot dynamically load the Apache Webdriver at runtime. Instead, you must rebuild your "httpd" binary, as described in Chapter 5 of the "Informix Web DataBlade Module Administrator's Guide." B. UPDATING THE APACHE WEB SERVER CONFIGURATION FILE "HTTPD.CONF" ------------------------------------------------------------------- This section assumes the "mod_so.c" module has been linked into your Apache "httpd" binary, as described in the previous section. To dynamically load the Apache Webdriver shared object at runtime, add the following LoadModule directive to the "httpd.conf" file: LoadModule informix_module \ $INFORMIXDIR/extend/web.4.10.UC1/apache/apache_/explode.so LoadModule directives must fit on a single line; for clarity, however, the preceding entry shows the LoadModule directive on two separate lines. In the preceding entry, $INFORMIXDIR refers to the main Informix directory, and refers to the version of the Apache Web server. For example, assume $INFORMIXDIR is /disk/ifmx and the version of your Apache Web server is 1.3.6. The following example shows the corresponding LoadModule directive in the "httpd.conf" file: Loadmodule informix_module \ $INFORMIXDIR/extend/web.4.10.UC1/apache/apache_1.3.6/explode.so After you update the "httpd.conf" file, restart the Apache Web server. Be sure you set the LD_LIBRARY_PATH and MI_WEBCONFIG environment variables either in the Web server startup script or in the environment of the user who starts the Web server. The LD_LIBRARY_PATH environment variable stores the location of the Informix libraries, and the MI_WEBCONFIG environment variable stores the full pathname of the Webdriver configuration file (web.cnf). III. THE "EXTENSIONS" WEBDRIVER VARIABLE ======================================== The "extensions" Webdriver variable is currently not documented in either of the two Web DataBlade module guides. By default, the "extension" Webdriver variable is set to "nocache," which means that Webdriver does not cache the information contained in the "wbExtensions" table. This is useful when you are developing AppPages, and possibly adding new extension types to the "wbExtensions" table: you do not want Webdriver to cache this information but instead to retrieve the information each time it is needed in case the information has changed. However, once you deploy your application to a production environment you should improve performance by caching the information in the "wbExtensions" table. To enable extension information caching, set the "extensions" Webdriver variable to "cache" in your Webdriver configuration. The name of the "extensions" Webdriver variable in versions of the Web DataBlade module up to and including Version 3.3 is MI_WEBEXTENSIONS. IV. THE "SCHEMA_VERSION" WEBDRIVER VARIABLE ============================================ The "schema_version" Webdriver variable is not documented in Version 4.0 of either of the two Web DataBlade module guides. If you use Data Director for Web or the new version of AppPage Builder included in Version 4.10.UC1 of the Web DataBlade module to develop AppPages, you must set the "schema_version" Webdriver variable to the value "wb." This Webdriver variable is automatically included in the "apb2" and "ddw" Webdriver configurations when you install the Web DataBlade Module Administration Tool in your database. If you use the former (3.32 and earlier) versions of APB to develop AppPages, you should not include the "schema_version" variable in your Webdriver configuration. The name of the "schema_version" Webdriver variable in versions of the Web DataBlade module up to and including Version 3.3 is MI_WEBSCHEMADEF. V. CONFIGURING THE DATABLADE MODULE WHEN THE WEB SERVER AND DATABASE SERVER ARE ON DIFFERENT COMPUTERS =========================================================================== Chapter 2 of the "Informix Web DataBlade Module Administrator's Guide" describes how to configure the Web DataBlade module when the Web server and database server are on the same computer. This section describes how to configure the DataBlade module if the two servers are on different computers. This procedure is for UNIX platforms only. To configure the Web DataBlade module when the Web server and database server are on different computers: 1. Perform all the tasks described in the section "Preconfiguration Tasks" in Chapter 2 of the "Informix Web DataBlade Module Administrator's Guide." 2. Log onto the database server computer as the owner of the database for which you are going to configure the Web DataBlade module. 3. Configure the database components by following the instructions in the section "Configuring Database Components," later in these notes. 4. Log onto the Web server computer as the user "informix." 5. Configure the Web server components by following the instructions in the section "Configuring Web Server Components," later in these notes. 6. Invoke the Web DataBlade Module Administration Tool in your browser by specifying the URL that the "websetup" utility provides at the end of its execution. Typically, this URL looks something like the following example: http://://admin/ The variable refers to the name of the Web server computer, refers to the port number of the Web server process, and refers to the name of the database you have just configured for the Web DataBlade module. Use the Web DataBlade Module Administration Tool to create new Webdriver mappings and Webdriver configurations. For example, you might want to add a Webdriver mapping to invoke AppPage Builder to begin developing Web applications. For detailed information on adding Webdriver mappings and configurations, refer to Chapter 3 of the "Informix Web DataBlade Module Administrator's Guide." A. CONFIGURING DATABASE COMPONENTS ------------------------------------- This section describes Step 3 of the procedure in the section "CONFIGURING THE DATABLADE MODULE WHEN THE WEB SERVER AND DATABASE SERVER ARE ON DIFFERENT COMPUTERS." The following procedure describes the steps you must perform on the database server computer. To configure the database components on the database server computer: 1. Copy the sample Webdriver configuration file, called "web.cnf.example," to the /tmp directory and rename it "web.cnf." The "web.cnf.example" file is located in the directory $INFORMIXDIR/extend/web.4.10.UC1/install. 2. Change to the directory $INFORMIXDIR/extend/web.4.10.UC1/install. 3. Run the "websetup" utility. Select option 2, "Configure Database Components Only." The utility guides you through the setup process. When the utility asks you for the directory that contains the "web.cnf" file, enter "/tmp." The "websetup" utility asks you a variety of questions about your environment and whether you want to install database components such as AppPage Builder. The utility configures the Web DataBlade module for your database server according to your answers. You can obtain helpful information about many of the screens by entering the letter "h." 4. Delete the file /tmp/web.cnf. 5. Change to the directory $INFORMIXDIR/extend/web.4.10.UC1/utils. 6. Run the "webconfig" utility as shown: webconfig -addmap -p //admin -n admin -d -u -o /tmp/temp_map Replace with the name of the database for which you are configuring the Web DataBlade module and with the owner of the database. The "-o temp_map" option of the "webconfig" utility creates a file in the current directory called /tmp/temp_map that contains a Webdriver mapping. You will import this file later when you are configuring the Web server components. 7. Change to the directory $INFORMIXDIR/extend/web.4.10.UC1. 8. Execute the UNIX "tar" command to create a TAR file that contains the necessary files for configuring the Web server components on the Web server computer, as shown: tar cvf /tmp/WebBundle.tar install netscape apache utils doc The "tar" command creates a TAR file called /tmp/WebBundle.tar that contains the directories install, netscape, apache, utils, and doc. 9. If you use, or are planning to use, the MIEXEC AppPage tag to execute Perl programs in your AppPages, add a WEB virtual processor to your database server by adding an appropriate VPCLASS parameter of the ONCONFIG file. For detailed information on this step, refer Chapter 2 of the "Informix Web DataBlade Module Administrator's Guide." This completes Step 3 of the procedure. B. CONFIGURING WEB SERVER COMPONENTS -------------------------------------- This section describes Step 5 of the procedure in the section "CONFIGURING THE DATABLADE MODULE WHEN THE WEB SERVER AND DATABASE SERVER ARE ON DIFFERENT COMPUTERS." The following procedure describes the steps you must perform on the Web server computer. To configure the Web server components on the Web server computer: 1. Copy the files /tmp/temp_map and /tmp/WebBundle.tar that you created while configuring the database components from the database server computer to the /tmp directory on the Web server computer. 2. Change to the main Informix directory ($INFORMIXDIR) on your Web server computer that contains the Informix client files. For example, if the main Informix directory is /local1/ifmx, execute the following UNIX command: cd /local1/ifmx 3. Create a directory called extend/web.4.10.UC1. For example, if the current version of the Web DataBlade module is 4.00.UC1, execute the following UNIX command: mkdir extend/web.4.00.UC1 4. Change to this new directory. 5. Using the "tar" command, extract the files from the /tmp/WebBundle.tar file into this directory. On UNIX, execute the following command: tar xvf /tmp/WebBundle.tar 6. Change directory to the "install" directory that is created after you extracted the files from the /tmp/WebBundle.tar file. On UNIX, execute the following command: cd install 7. Run the "websetup" utility. Select option 3, "Configure Web Server Components Only." The utility guides you through the setup process. The "websetup" utility asks you a variety of questions about your environment and the location of your Web server. The utility configures the Web server components according to your answers. Be sure you note the directory in which the "websetup" utility stored the "web.cnf" Webdriver configuration file. You can obtain helpful information about many of the screens by entering the letter "h." 8. Set the environment variable MI_WEBCONFIG to the full pathname of the "web.cnf" file created by the "websetup" utility. 9. Change to the directory $INFORMIXDIR/extend/web.4.10.UC1/utils. 10. Run the "webconfig" utility as shown: webconfig -addmap -i /tmp/temp_map The "-i temp_map" option of the "webconfig" utility imports the file /tmp/temp_map that you copied to the /tmp directory into the "web.cnf" file. 11. If you are using the Apache, ISAPI, or CGI Webdriver, refer to the appropriate chapters in the "Informix Web DataBlade Module Administrator's Guide" for instructions on how to complete the configuration of these Webdriver implementations. This completes Step 5 of the procedure. VI. RETRIEVING INFORMATION ABOUT SERIAL COLUMNS WITH THE MISQL TAG ==================================================================== The following two attributes of the MISQL AppPage tag are not documented in the "Informix Web DataBlade Application Developer's Guide": SERIAL and SERIAL8. Use these attributes to return the value that the database server automatically inserts into a SERIAL or SERIAL8 column after you execute an appropriate INSERT statement with the MISQL AppPage tag. Within the MISQL AppPage tag, set the SERIAL or SERIAL8 attribute to the name of a variable that you can subsequently query to find out what serial number was inserted into the column. For example, assume you have previously created a table with the following SQL statement: CREATE TABLE serialtest ( id SERIAL, id8 SERIAL8, name VARCHAR(20) ); The following sample HTML shows how to use the MISQL AppPage tag to insert a row into the "serialtest" table and then use the MIVAR AppPage tag to return the values that the database server automatically inserted into the two serial columns: Value of serial column was serialvar

Value of the serial8 column was serial8var VII. LIMITING LOOP PROCESSING WITH THE MIBLOCK TAG =================================================== The MI_LOOP_MAX WebExplode() variable is not documented in the "Informix Web DataBlade Application Developer's Guide." Use this variable to set the maximum number of loops when you use the FOR, FOREACH, and WHILE attributes of the MIBLOCK AppPage tag. During loop processing, if the maximum number of loops is reached, the WebExplode() function raises an exception and stops loop processing. Use the Web DataBlade Module Administration Tool to set the MI_LOOP_MAX WebExplode() variable for your Webdriver configuration. For example, assume you have previously set the MI_LOOP_MAX WebExplode() variable to 100 in your Webdriver configuration and you execute the following AppPage: We are in an infinite loop Although logically the previous MIBLOCK statement results in an infinite loop, processing stops as soon as 100 loops have been executed, and you will receive an error in your AppPage. VIII. LIMITING THE NUMBER OF TIMES THE WEBEXPLODE() FUNCTION CAN BE CALLED RECURSIVELY =========================================================================== The MI_WEBEXPLODE_DEPTH WebExplode() variable is not documented in the "Informix Web DataBlade Application Developer's Guide." Use this variable to set the maximum number of times you can recursively call an AppPage. You recursively call an AppPage by explicitly executing the WebExplode() function on the AppPage with the MISQL tag. Use the Web DataBlade Module Administration Tool to set the MI_WEBEXPLODE_DEPTH WebExplode() variable for your Webdriver configuration. For example, assume you invoke the following AppPage called "/recurse.html", passing it the name/value pair DEPTH=10: (-,DEPTH,1) DEPTH : DEPTH 1 This AppPage calls itself recursively. If the MI_WEBEXPLODE_DEPTH WebExplode() variable has not been set, then the AppPage calls itself recursively until all database server resources have been used. If, however, you set the variable to 100, the AppPage calls itself 100 times, and then stops. IX. MAXIMUM VALUE OF THE "max_html_size" WEBDRIVER VARIABLE ============================================================= The maximum value of the "max_html_size" Webdriver variable is 2^32. This variable is called MI_WEBMAXHTMLSIZE in Versions 3.32 and earlier of the Web DataBlade module. X. USING VARIABLE-PROCESSING FUNCTIONS IN ATTRIBUTES OF APPPAGE TAGS ======================================================================= Although the "Informix Web DataBlade Module Application Developer's Guide" does not explicitly say so, you should always enclose variable-processing functions used in any attribute of an AppPage tag in double quotes. For example, the following MISQL AppPage tag includes a variable-processing function, enclosed in double quotes, in its COND attribute: ,val1,val2)" SQL="select * from staff;"> XI. RETRIEVING LARGE OBJECTS BY THEIR LARGE OBJECT HANDLES ============================================================ The "Informix Web DataBlade Module Application Developer's Guide" shows how to retrieve large objects by specifying the names by which they are stored in the "wbBinaries" table. This section describes how you can retrieve a large object into your AppPage based on its large object handle (its unique identifier within the database in which it is stored.) This method is particularly useful when retrieving large objects that are NOT stored in the "wbBinaries" table. You can retrieve large objects by their large object handle when you dynamically retrieve the results of a SELECT statement. First, use the Web DataBlade Module Administration Tool to set the following Webdriver variable in your Webdriver configuration. ----------------------------------------------------------------------------- | Webdriver Variable | Mandatory? | Description | |===========================================================================| | MItypeObj | Yes | MIME type and subtype used to | | | | export the large object, such as | | | | "image/gif." | | | | | | | | Be sure you check the Overwrite | | | | checkbox when you add this | | | | variable to your Webdriver | | | | configuration. | ----------------------------------------------------------------------------- Then, in your AppPage, use the MISQL AppPage tag to select the large object from the table. Finally, use the LO Webdriver variable together with WEB_HOME to specify the selected large object handle and retrieve the large object into your AppPage. IMPORTANT: Do not set the LO Webdriver variable in your Webdriver configuration, since this forces Webdriver to ignore the MIval Webdriver variable. Only specify the LO Webdriver variable in the URL you use to retrieve the large object. For example, assume you have stored images in the "object" column of a table called "webImages." The following AppPage retrieves one of the images using its large object handle: Retrieving Large Objects

Display the image



For more information about large objects, see the "Informix Guide to SQL: Reference." XII. EXECUTING AN SQL STATEMENT GREATER THAN 32 KB WITHIN AN MISQL APPPAGE TAG =========================================================================== By default, the database server returns an error if you try to execute an SQL statement larger than 32 KB within an MISQL AppPage tag. An example of an SQL statement that could be larger than 32 KB is an INSERT statement that inserts a large AppPage into a table. To work around this problem, use the PREPARE attribute of the MISQL AppPage tag together with placeholders within the SQL statement to shorten the SQL statement. Use the PREPARE attribute to specify the name of a variable that contains the large chunk of text (such as the entire AppPage that is going to be inserted) and then use a question mark (?) in the SQL statement to show where this text should be substituted once the SQL statement is actually executed. For example, assume you store movie descriptions in a table with the following schema: CREATE TABLE movies ( id INTEGER, name VARCHAR(30), description LVARCHAR ); The following AppPage snippet shows how to use the MIVAR AppPage tag to first store text data in a variable called "the_text" and then use the PREPARE attribute of the MISQL AppPage tag to insert the text into the table. (For the sake of clarity, the sample text is short; in reality you should only use the PREPARE attribute for text that is larger than 32 KB.) The movie was great. To use more than one placeholder in the SQL statement, use a vector variable to store the text, as shown in the following example: Citizen Cane A movie classic. IMPORTANT: You should use the PREPARE attribute of the MISQL AppPage tag only for SQL statements that are larger than 32 KB since use of the attribute might cause the SQL statement to execute more slowly. XIII. EXAMPLE OF GENERATING XML-FORMATTED DATA WITH THE WEB DATABLADE MODULE ============================================================================ You can use the MISQL AppPage tag to generate XML-formatted data based on rows in a table. You can do this in the following two ways: * use the MISQL AppPage tag to retrieve only data from the table and specify your own XML tags * use XML-specific attributes of the MISQL AppPage tag to generate default XML tags as well as retrieve data from the table Both methods are discussed in the following sections. The examples in this section use the following table and data: CREATE TABLE people ( id INTEGER, name VARCHAR(30) ); INSERT INTO people VALUES (1, 'Mary Smith'); INSERT INTO people VALUES (2, 'John Grant'); A. ADDING AN "XML" EXTENSION TO THE wbExtensions TABLE ------------------------------------------------------ AppPages that create XML-formatted data must use the extension "xml" in their names. You can check that an "xml" extension exists in the "wbExtensions" table in your database by invoking AppPage Builder (APB) and clicking "Admin Menu" and "Edit Extension." Check for the "xml" extension in the drop-down list. If there is no "xml" extension in the drop-down list, then you must add one to the wbExtensions table. To do this in APB, click "Add Extension" from the admin menu AppPage and type the following values for the indicated text boxes: Extension: XML Name: XML Page Source Table: wbPages Super Type: text Sub Type: xml ID Column: ID Content Column: object Path Column: path Retrieval Method: WebExplode Click Save. APB adds the "xml" extension to the wbExtensions table and you are ready to create an AppPage that generates XML-formatted data. IMPORTANT: Currently, the only browser that can use XML data is Microsoft's Internet Explorer, Version 5. B. GENERATING XML-FORMATTED DATA USING YOUR OWN XML TAGS --------------------------------------------------------- The following AppPage shows how you can generate XML-formatted data from the data in the "people" table: 1 2 When you invoke this AppPage, the WebExplode() function generates the following XML: 1 Mary Smith 2 John Grant In this example, you specify all the XML tags (such as and ) in the standard way of using the MISQL AppPage tag. C. GENERATING XML-FORMATTED DATA USING ATTRIBUTES OF THE MISQL APPPAGE TAG --------------------------------------------------------------------------- Starting with Version 4.00.UC2 of the Web DataBlade module, you can use XML-specific attributes of the MISQL AppPage tag to automatically generate an XML stream with default XML tags. The following table describes these XML-specific attributes. ----------------------------------------------------------------------------- | MISQL Attribute | Description | |===========================================================================| | XMLDOC | Specifies the DOC type of the generated XML stream. | | | | | | You must specify this attribute for the WebExplode() | | | function to generate an XML stream. | |-----------------+---------------------------------------------------------| | XMLROW | Specifies the name of the XML tag that delineates rows. | | | | | | If you do not specify this attribute, the WebExplode() | | | function generates the default and tags. | |-----------------+---------------------------------------------------------| | XMLVERSION | Specifies the version of XML. | | | | | | If you do not speciy this attribute, the default is 1.0.| ----------------------------------------------------------------------------- The following AppPage snippet shows how to use these attributes to generate an XML stream similar to that in the previous section: When you invoke this AppPage, the WebExplode() function generates the following XML: 1 Mary Smith 2 John Grant Note that in the preceding XML, the XML tags that delineate the columns have the same name as the columns themselves. If you want to change the name of the tags that delineate the columns, use the AS keyword in your SELECT statement, as shown in the following example: When you invoke this AppPage, the WebExplode() function generates the following XML: 1 Mary Smith 2 John Grant XIV. SETTING DBDATE AND DBCENTURY INFORMIX ENVIRONMENT VARIABLES ================================================================= Page 3-13 of the "Informix Web DataBlade Module Administrator's Guide" incorrectly states that you should set the DBDATE and DBCENTURY Informix environment variables in the Setvar section of the "web.cnf" file. The WebExplode() function ignores these environment variables if they are set in the "web.cnf" file. To correctly set these environment variables, you should set them in your environment before you register the DataBlade module into your database. This change is because the database server no longer reads the DBDATE and DBCENTURY environment variables at runtime. XV. AUTOMATICALLY CLOSING IDLE WEBDRIVER CONNECTIONS TO THE DATABASE ====================================================================== You can now use a new Webdriver variable called "dbconntimeout" to set the maximum time (in seconds) that a Webdriver connection to the database is allowed to be idle. Webdriver automatically closes any database connections that have been idle for longer than the value of "dbconntimeout." You set this Webdriver variable in the Global section of the "web.cnf" file. The following sample Global section of the "web.cnf" file shows how to set the "dbconntimeout" Webdriver variables to 120 seconds: debug_file /tmp/driver.log debug_level -1 dbconntimeout 120 dbconnmax 128 anchorvar WEB_HOME/ Setting "dbconntimeout" to 120 means that if no database request is made on a connection for 2 minutes, then Webdriver closes the connection. XVI. DOCUMENTATION ERRORS IN THE APPLICATION DEVELOPER'S GUIDE =============================================================== This section describes a documentation error in the "Informix Web DataBlade Module Application Developer's Guide." A. USING RAW MODE WITH WEBDRIVER -------------------------------- The example on page A-2 of the guide contains an error. The URL to retrieve the "/testit.html" AppPage in RAW mode should be: http://myhost:port/hr_app/?MIval=/testit.html&RAW=topsecret