Solved

Using CGI to integrate databases on the Web

Posted on 2000-05-08
3
210 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now