MOWI in StandAlone Mode
When MOWI runs in standalone mode (called mowistub <-notice the case here) it acts like a html to stored procedure translator for your web server.
Each time your web client connects, mowistub is launched, connects, disconnects and returns output to your client. The mowistub program is usually pretty big, so each time it launches, it can cause a big hit on your server's resources.
The whole MOWI process in stand alone mode is outlined below:
- Step 1
- The client connects to your web server (hear after called httpd)
- Step 2
- Httpd decides whether the request is for a static page or one stored in Oracle. We're only interested in Oracle based data so...
Your httpd server calls what is known as a CGI script (mowi). This script is used to set some critical environment variables like ORACLE_HOME and ORACLE_SID. These environment variables are used by every process that interacts with Oracle including SQL*Plus etc. In most cases, another environment variable is set (MOWI_UID). This variable is the userid/password combination used to connect to Oracle.
- Step 3
- During step 3, the CGI script launches the mowistub program. Notice the lack of capitalization in the name. The mowistub program is a pretty large executable program and can cause a sizeable resource hit on your machine. The best way to reduce this hit is to buy more RAM
- Step 4
- This is a complicated process so it is broken down into several steps.
- Mowistub will login to oracle using the userid/password stored in the MOWI_UID environment variable. Actually mowistub will check three different environment variables to determine the correct Oracle userid and password. They are checked in order and are: MOWI_UID, WOW_UID and UID.
- Mowistub will read the input from the cgi script, which in turn came from the httpd server, and package it up into a stored procedure call. The request must be either an http GET or POST request.
- As the request is processed, mowistub will attempt to determine if any of the input variables (on an HTML form) are arrays. Forms that have more than one item (a checkbox, or textbox, etc) with the same name, will automatically be processed as arrays.
- Mowistub will "describe" the Oracle stored procedure to be called. Based on the results of this describe, mowistub will pick the FIRST most likely definition of a procedure. So, if you have "overloaded" your procedure calls, mowistub will stop checking their descriptions when it finds the first procedure with all the correct matching items on the HTML form. It is critical to note that the items on the HTML form will be matched in the order that they are received by mowistub. Mowistub will not re-order the items on your HTML form to match the Oracle stored proceddure call. This behavior may change at a later date.
- Certain environment variables will be packaged up and included with the call to your stored procedure. The variables will be available as Oracle global variables. They include: REMOTE_ADDR, REMOTE_HOST, REMOTE_USER, HTTP_ACCEPT, SERVER_SOFTWARE, SERVER_NAME, GATEWAY_INTERFACE, SERVER_PROTOCOL, REQUEST_METHOD, PATH_INFO, and MOWI_SPARE. You can add your own variables to this list by modifying the mowi.c file and the list of global variables in mowi.sql To get to the CGI variables in your stored procedure just refer to them as mowi.VARIABLE_NAME where VARIBALE_NAME is on of the variable names mentioned above.
- Once the input data is packaged up, mowistub will call the stored procedure used in the request. It will then read from the dbms_output package until there is no more data stored there. If you don't return any data to the client during your stored procedure call, then the web client won't receive any data either. You must output data with the routines stored in the htp and htf packages.
- Step 5
- During this step, data is read from dbms_output and sent back to the client. Mowistub will logoff from Oracle and exit.
- Step 6
- Mowistub will return data to the CGI script through stdout
- Step 7
- The mowi CGI script will return data to the webserver through stdout
- Step 8
- The httpd server will return data to the web client
The whole process is less complicated than the deamon mode version, but my still take longer to run because mowistub must be loaded into RAM and run.
Why use MOWI in standalone mode?
- Clients stay connected to Oracle only for breif periods of time. Thus freeing up potentialy tight user limits
- Administrative overhead of running the deamon may not be worth the server hit of running in standalone mode. No control files to check, or deamons to keep an eye on. Every connect and disconnect takes care of itself
- The RAM bloat problem with the Oracle Call Interface is less of a problem.
Back to the MOWI home page
Oracle, Oracle Call Interface, OCI, and PL/SQL are trademarks of Oracle Corporation. (Hope I haven't missed anyone)