?
Solved

Using CGI to integrate databases on the Web

Posted on 2000-05-08
3
Medium Priority
?
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
maneshr earned 400 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

How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

Question has a verified solution.

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

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

743 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