How Does htmSQL Work?

htmSQL is a CGI program that is written in the C language and resides on your Web server. It can process special directives that are embedded in an HTML file. These directives describe one or more SQL statements and incorporate formatted results into the Web page that is created by the HTML file.
htmSQL passes your SQL to a SAS/SHARE server, performs the requested updates and queries, and retrieves the results sets. The desired page is created dynamically and returned through the Web server to the Web browser. See the data flow and required components in the following diagram:
[htmSQL diagram]
The Web server calls htmSQL each time it receives a URL that specifies the htmSQL program name. htmSQL supports both the GET and POST CGI methods for sending form data.
htmSQL reads the input file for information that is contained within any of its directives. It processes this information and returns the results to the Web server. It returns all HTML information to the Web server just as it appears in the input file.
The following example illustrates a URL for htmSQL:
http://yourserver/dir/executable_file/filename.hsql?query_string
  • yourserver is your Web server host name (and port, if required).
  • dir is the path of the Web server CGI program directory that contains htmSQL.
  • executable_file is the htmSQL program name. For UNIX and z/OS, the program name is htmSQL. For Windows, the program name is htmSQL.exe.
  • filename.hsql is your htmSQL input file. Each file can contain multiple SQL statements and other input files by reference.
  • query_string specifies values for one or more of the variables that are referenced in the input file. The variable name and value pairs are separated by ampersands (&) and are specified using the following format:
    var1=value1&var2=value2&...varN=valueN
Note: Some Web servers can be configured to recognize an input file by its file extension and to automatically call the appropriate CGI program to process the file. If your Web server can be configured this way, you can omit the path to htmSQL when you specify the URL (that is, you can omit the dir and executable_file values). Consult your Web server documentation for details about whether and how your server can be so configured.
For more information about CGI and CGI scripting, refer to the Common Gateway Interface documentation provided by W3C at www.w3.org/CGI.