CGI Kit

This document addresses the most commonly asked questions about the Informix CGI Interface Kits. The FAQ is a compilation of questions and conversations that can help you in getting the latest information. Please help us maintain the usefulness of this FAQ by sending us your corrections and additions.

Table of Contents


  1. Introduction to Informix WWW Interface Kit
  2. Obtaining and Using Informix WWW Interface Kit
  3. General Questions
  4. Common Error Messages and Work Arounds
  5. INFORMIX-4GL WWW Interface Kit Questions
  6. INFORMIX-ESQL/C CGI Interface Kit Questions
  7. Platform-Specific Questions
  8. Language-Specific Questions
  9. Other Resources on the Web
  10. Bug Fixes and Assistance
  11. Glossary of Terms
  12. Credits
Comments/Suggestions for CGI KIT

1.0 Introduction to Informix WWW Interface Kits

For Informix customers currently using INFORMIX-ESQL/C or INFORMIX-4GL development tools with their databases, we've put together two free interface kits to facilitate your Web connectivity. Each kit contains the complete source code to help you write CGI programs that can interface with Informix databases. A CGI program is executed is real time by the Web daemon and transmits the information to the database engine. Also included with each kit are simple, self-contained examples you can build yourself. The goal of the CGI Interface Kits is to simplify the programs you write to achieve Web connectivity conforming to the standards. The Informix interface kits assist developers in connecting Informix databases to the World Wide Web.

2.0 Obtaining and Using Informix WWW Interface Kits

The INFORMIX-ESQL/C CGI Interface Kit and INFORMIX-4GL CGI Interface Kit can be downloaded from our Informix World Wide Web Interface Freeware page. The freeware Web page contains all the information needed to transfer the kits, with examples and documentation on the kits.

3.0 General Questions

  1. What is CGI?

    The Common Gateway Interface (CGI) is a standard for external gateway programs to interface with information servers such as the HTTP servers. Additional documentation on the CGI gateway can be obtained from NCSA Httpd Overview.

  2. How do I access the Web?

    There are many navigators available on the Internet for various platforms. One of the more commonly used navigators is Netscape. To execute your CGI programs you need access to a Web server. Many HTTP compatible servers for creating hypertext and other documents available to Web browsers are available on the Internet. Some freely available servers are the NCSA and CERN servers. NCSA httpd is a HTTP/1.0 compatible server. CERN WWW server is another option. Commercial versions are available with enhanced security and many features not found in these public domain versions.

  3. What versions of INFORMIX-4GL and INFORMIX-ESQL/C are compatible with the INFORMIX-4GL and INFORMIX-ESQL/C CGI Interface Kits?

    The 4GL CGI Interface Kit has been tested with c4GL version 6.0, RDS 6.0, INFORMIX-OnLine 7.10, and up. It is best to have the latest INFORMIX-4GL product version. For INFORMIX-ESQL/C, version 7.10 and up are the best options. Though our kits have been tested with the most recent versions, we do not expect any problems with the earlier versions.


4.0 Common Error Messages and Work Arounds

  1. "/usr/informix/bin/esql" not found error unknown

    Refer to Section 5.0 question number 4.

  2. "Making makefile lib4glcgi.mak from lib4glcgi.std" prompt continues to stay

    Refer to Section 5.0 question number 5.

  3. "Document contains no data error"
Refer to Section 5.0 question number 10.

5.0 INFORMIX-4GL WWW Interface Kit Questions

  1. What do I do if I get error messages like "ld: lib4glcgi.a: warning: archive has no table of contents; add one using ranlib"?

    Ranlib creates a table of contents that is added to an archive. It is possible that the ranlib command was not invoked. Try "ranlib archive filename" or try "ar -s archivefile". Also, whenever you are using ranlib et.c make sure you have a good amount of temporary swap space. If not, it is a good idea to strip the object file of the debugging info.

  2. Problems downloading the kit

    We do not currently support a facility for you to download the kit by anonymous ftp. All downloads have to be made through our Web site. We are aware that some of our clients have experienced problems downloading the kit. These problems were corrected. Send us a note if you are still facing problems in downloading the kit.

  3. Is there support for BLOBs with INFORMIX-SE?

    The purpose of cgiprintblob.ec program is to be able to print BLOBs out to the stdout. BLOBs are only supported with INFORMIX-OnLine. If you have INFORMIX-SE you will not be able to support BLOBs in your program.

  4. How do I solve the "/usr/informix/bin/esql" not found error unknown?

    This problem is usually faced by most clients who do not have the ESQL product. In the 4GL kit a couple of programs are present. Please make this change in the 4GL makefiles that make use of the INFORIX-ESQL/C library. To compile them you need to use a c4GL. The following change in your lib4glcgi.std will fix it.

    CESQL = $(INFORMIXBIN)/esql

    ESQL = $(INFORMIXBIN)/esql

    to:

    CESQL = $(INFORMIXBIN)/c4gl

    ESQL = $(INFORMIXBIN)/c4gl

  5. When I run the make command it displays the message "Making makefile lib4glcgi.mak from lib4glcgi.std" and I don't get the prompt back. What do I do?

    We had one of our customers experience this problem on a SunOS 4.1.3_DB 1 sun4 platform. It seems the problem is that the OSNAME variable in the lib4glcgi.std is not getting initialized to the one for your environment. A solution is to edit the libcgiusr.std file and set the OSNAME to your operating system's name. You could use the uname command to find out the OSNAME for your platform.

  6. How do I solve the "cgisetenv.c", line 337: warning: illegal pointer combination" warning?

    One of our clients had this problem when working on a SunOS platform. This was caused by the bsearch function returning an integer to a character pointer. The problem was fixed with the following:

    Change in find_env function:
     env = bsearch(&newval, environ, env_used, sizeof(char **), env_cmp);
    to:
    env = (char **) bsearch(&newval, environ, env_used, sizeof(char **), env_cmp);
    

  7. How do I solve "ld: Undefined symbol __tolower" problem?

    As pointed out by our client, they had a BSD compiler which couldn't handle the other _tolower function. The following changes solved the problem:

    i4glaccess.c:    for (pc=perms; *pc!=NULL;*pc=(char)tolower(*pc), pc++);
    
    icgigetvalue.ec:        downshifted[i] = _tolower(name[i]);
    

    Changing the macro by just removing the underscore fixed the problem here:

    i4glaccess.c:    for (pc=perms; *pc!=NULL;*pc=(char)tolower(*pc), pc++);
    icgigetvalue.ec:        downshifted[i] = tolower(name[i]);
    

  8. Can the 4GL kit be used without ESQL?

    Yes, it can. The C compiler version c4GL can preprocess a ESQL code and turn the same into C source code, and can then be compiled and linked. Please make this change in the 4GL makefiles:

    CESQL = $(INFORMIXBIN)/esql
     ESQL = $(INFORMIXBIN)/esql
    to
    CESQL = $(INFORMIXBIN)/c4gl
     ESQL = $(INFORMIXBIN)/c4gl
    

  9. If I do not have c4GL or INFORMIX-ESQL/C how do I compile my .ec programs?

    You have to build a customized runner. A make file cgi_rds.mak has been provided with the kit. The output of the same is a customized runner called cgi_runner.

  10. How do I solve the "document contains no data" error when I use the 4GL kit with my RDS?

    Let's say you had a .4gi file named testdrive.4gi and you invoked it as http://www.informix.com/cgi-bin/cgi_runner?testdrive.4gi. You would get the error message since your http server is not able to locate the .4gi file. To solve this problem, simply provide the full path in the URL. You would invoke the same file as:

    http://www.informix.com/cgi-bin/cgi_runner?/usr/local/www/cgi-bin/testdrive.4gi


6.0 INFORMIX-ESQL/C CGI Interface Kit Questions

  1. How do I solve the "ld: Undefined symbol
    _rgetlmsg" unknown?

    The release of INFORMIX-ESQL/C library before version 6.0 had the function rgetmsg. The versions after 6.0 use the function rgetlmsg. So if you are using INFORMIX-ESQL/C 4.0 or 5.0 you need to change all occurrences of rgetmsg to rgetlmsg in the programs. The parameters must also be changed. The INFORMIX-ESQL/C Programmer's Manual has a list of the prototypes for both these functions.


7.0 Platform-Specific Questions

Porting Considerations

  1. On what platforms has the kit been tested?

    Informix has certified the INFORMIX-ESQL/C CGI Interface Kit for the Sun Solaris, Hewlett-Packard HP-UX, Silicon Graphics IRIX, and IBM AIX platforms. Where possible, standard UNIX commands were used so chances are the kit will also compile on your UNIX platform. In the spirit of making our products as open as possible, we will continue to certify this kit for additional platforms in the near future. The kit hasn't been adequately tested for RDS systems.

  2. Can I use the kit on any other platform?

    You may try. Please feel free to edit the .std files and other makefiles. You could refer to your man pages for documentation on make and make suitable changes. If you resolve problems during compilation, please send us mail indicating the error and your workaround.

    NT

  3. Is there a support for NT?

    No, currently we do not have support for Windows NT.

    AIX

  4. A few of our clients have had problems compiling cgiprintblob.ec with compilation errors such as "/informix/incl/esql/locator.h", line 115.7: 1506-046 (S) Syntax error, and previously defined typedef identifier: loc_t, "cgiprintblob.ec", line 78.19: 1506-022 (S) loc_type not a member of the struct or union blob_loc.

    This is a known problem. On AIX there is a header file named /usr/include/sys/localedef31.h. In the header file there is a typedef in this file declared as loc_t. This name conflicts with an Informix structure declaration in $INFORMIXDIR/incl/esql/locator.h which is pulled in on all INFORMIX-ESQL/C compiles.To make sure that you don't get the redeclaration errors, please try the following. The header file stdlib.h doesn't need to be uncommented.

    You can then compile and link as normal. You can have your makefile perform these steps automatically so that your original source always contains loc_t. We are working on a better solution for this bug and shall update it soon.


8.0 Language-Specific Questions

  1. What will the cgi_get_form_entry return for multiple list selection?

    The cgi_get_form_entry returns the first successful match for a given name tag.

  2. How do I solve the problem of obtaining the entire list of selected options?

    One way is that you could use the global variable entrylist_lst to traverse through the linked list of name value pairs and copy those values that have the corresponding name tag you are looking for.

    The other way is to code up a simple function like cgi_get_form_entry() in cgigetfrment.c. Instead of returning a pointer to the entry that corresponds to the name sent as a parameter, this returns a pointer to a linked list of name-value pairs that contains the selections in the multiple selection list. For example, here is a simple pseudo code:

    //returns a linked list of name-value pairs that have entries corresponding to a multiple   
    //selection list
    t_cgi_entry * cgi_get_form_entry(name)
    char *name;
    {
      //entrlist is  a global variable that can be used to
      // traverse the list of name-value pairs
      t_cgi_entry *n = entrylist_list;
      t_cgi_entry *newlist;
      for(; n!= NULLENTRY; n = n->next)
      {
        if(strcmp(n->name, name) == 0 )
        // add to newlist
        //remember to allocate space
      }  
    //return head of the newlist
    }
    

    Another solution is:

    Have a function like
    // Prints to the standard output name-value pairs that have an entry same as the input
    // paramaeter.
    cgi_print_sel_list(char *name)
    {
    
      t_cgi_entry *n = entrylist_list;
      for(; n!= NULLENTRY; n = n->next)
      {
          if(strcmp(n->name, name) == 0 )
          //print the value to standard output
      }
    }
    

9.0 Other Resources on the Web


10.0 Bug Fixes and Assistance

We do not yet offer customer support for the CGI Interface Kits. We will, however, solve the major bugs in our future releases. To aid us in uncovering bugs, please send us your bug reports and any other comments and suggestions to Comments and Suggestions for CGI Kits.

11.0 Glossary of Terms


12.0 Credits

We express our thanks to all users of the CGI Interface Kits and the feedback they gave us. It helped us immensely in creating this FAQ. We look forward to enhancing the functionality of the kit in the near future and thank you for your comments and suggestions. If you have a question, and would like it added to this page, please let us know.


[ Home ] [ Table of Contents ] [ Search ] [ CGI Kit Help ] [WWW Databases ]

Copyright © Informix Software. All Rights Reserved. s/m 11.30.95