Solved

Using CGI to integrate databases on the Web

Posted on 2000-05-08
3
226 Views
Last Modified: 2013-12-25
Can anyone explain to me exactly how CGI scripts are used to integrate databases on the Internet? Where are the CGI scripts stored? How are they invoked. are they embedded in HTML? Is this a good method to choose for integrating your database on the web?
0
Comment
Question by:paulinebelford
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
maneshr earned 100 total points
ID: 2790401

Q) Can anyone explain to me exactly how CGI scripts are used to integrate databases on the Internet?

A) Chek out this URL. it will answer all your DB questions and then some more!!.
http://wdvl.com/Authoring/DB/Intro/


Q) What is CGI?

A) The Common Gateway Interface, or CGI, is a standard for external
gateway programs to interface with information servers such as HTTP servers.
A plain HTML document that the Web daemon retrieves is static,
which means it exists in a constant state: a text file that doesn't change.
A CGI program, on the other hand, is executed in real-time, so that it
can output dynamic information.

Q) Do I have to call it *.cgi? *.pl?

A) Maybe.   It depends on your server installation.

These types of filenames are commonly used conventions - no more.
It is up to the server administrator whether or not CGI scripts are
enabled, and (if so) what conventions tell the server to run or
to print them.

If you are running your own server, read the manual.
If you're on ISP or other rented webspace, check their webpages for
information or FAQs.   As a last resort, ask the server administrator.

=====================================================
CGI is just a protocol, a formal agreement between a web server and a separate program. The server encodes the client's form
input data, and the CGI program decodes the form and generates output. The protocol says nothing regarding which language
the program must be written in; programs and scripts that obey the CGI protocol have been written in C, shell, Rexx, C++,
VMS DCL, Smalltalk, Tcl, Python, and (of course) Perl.

The full CGI specification lays out which environment variables hold which data (such as form input parameters) and how it's all
encoded. In theory, it should be easy to follow the protocol to decode the input, but in practice, it is surprisingly tricky to get
right.

CGI scripts are called in two main ways, referred to as methods  - but don't confuse HTTP methods with Perl object methods!
The HTTP GET method is used in document retrievals where an identical request will produce an identical result, such as a
dictionary lookup. A GET stores form data in the URL. This means it can be conveniently bookmarked for canned requests,
but has limitations on the total size of the data requested. The HTTP POST method sends form data separate from the request.
It has no such size limitations, but cannot be bookmarked. Forms that update information on the server, like mailing in feedback
or modifying a database entry, should use POST. Client browsers and intervening proxies are free to cache and refresh the
results of GET requests behind your back, but they may not cache POST requests. GET is only safe for short read-only
requests, whereas POST is safe for forms of any size, as well as for updates and feedback responses. Therefore, by default,
the CGI module uses POST for all forms it generates

=================================
Simplest CGI Program

Here's the source code for your first CGI program; it's so simple, it doesn't even need to use the CGI.pm module:

#!/usr/bin/perl -w
# howdy--the easiest of CGI programs
print <<END_of_Multiline_Text;
Content-type: text/html
 
<HTML>
    <HEAD>
    <TITLE>Hello World</TITLE>
    </HEAD>
    <BODY>
    <H1>Greetings, Terrans!</H1>
    </BODY>
</HTML>
 
END_of_Multiline_Text

0
 

Author Comment

by:paulinebelford
ID: 2791620
Thank you for your help. That web site has an overwhelming amount of information (!) but I am less confused now :)

Pauline
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2792435
Glad to know that you find the info userful.

one last piece of advice. i would suggest that while you are going thru the info on the web-site, if you find any piece/section confusing/difficult to understand, just skip it and move on.

once you have a good understanding of the concept, you can revisit that peice/section and i am sure you will find it a piece of cake!!

Wish you all the best.

Rgds
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question