Solved

Using CGI to integrate databases on the Web

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
The viewer will learn how to dynamically set the form action using jQuery.
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 …

911 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

20 Experts available now in Live!

Get 1:1 Help Now