Welcome to CGI City - One of the biggest WWW Resources for CGI and Perl materials
CGI City Articles

Adding A Database To Your Web Site
Article by: Peter Go

Anybody who is involved in building web sites should know that growth becomes inevitable over a period of time. If a web site has not grown in terms of either number of visitors or online revenue, then I highly recommend rethinking the web strategy being employed.

When one builds a web site, it usually starts out small and with very humble features. Perhaps some basic information about one's offerings coded in static HTML, maybe a message board here and a form mailer there - that was it. But as time passed, some growth took place. Numbers of visitors increased, more products and services are being offered, more repeat customers, more pages, more demands, more of this and more of that. In shorts, growth brings in chaos - a very welcome chaos.

The keen webmaster is quick to react to such a chaos. He knows that he needs to make it simpler for both him to manage the web site and for his customers to navigate through it. He plans on making most of his frequently updated pages dynamically generated. This means no more static HTML. Instead, everything is created on the fly. The webmaster knows he must wield this kind of control in order to cope with much of the demands brought about by growth. The solution he has in mind is to manage all his web data with the help of a database.

Why Do I Need A Database?

Without even knowing it, some of us are in fact, already using databases. Maybe not in the strictest sense of the word, but many people store important data into a systematic and orderly medium where they can easily access and retrieve them for later use. Some of us store company names and contact information into our email software's built-in address book. Some store information related to processed orders using a spreadsheet software. Still, some simply store them into plain text formats. Believe it or not, these practices are in a crude sense, managing one's database.

To a webmaster, being able to integrate these examples to the web would be advantageous. It would be ideal if he can integrate his customer's data into a web database application so he access them from wherever he is (as long as he has a web browser and an internet connection).

It is also advantageous to companies with field salespeople or if they have different branch offices all over the country. Easy access to data via a web browser means faster turn-around time and faster results.

To the webmaster, having all the data accessible via the web means fuller control and time saved. This means higher productivity and efficiency.

Dynamic Contents

Have you ever wondered how content-driven web sites like CNN.com produce and manage their news contents in a timely manner? The CNN web site probably contains thousands and thousands of news documents. Do you think these documents are coded and stored as individual HTML files? Definitely not.

Most likely, their web site uses a very complex database system to dynamically generate their pages. This is a more feasible method of managing the amount of data a web site like CNN generates on a day-to-day basis. Each news story, article, advertisement, feature story, is stored in a database. The system uses page templates also stored in databases. Now when visitors access the web site, pages are created dynamically on the fly. Having a system such as this affords the site manager to focus more on developing the content more than the managing of the web site.

Sold? What Next?

Let me make a forewarning - database integration requires a high degree of technical proficiency. This is not for the novice web developer because it requires at least some basic understanding of server-side programming and database concepts.

First thing to do is determine your database requirement. What do you need the database for? Is it for storing a small number of data that will be accessed by privileged users only? Or will it be storing hundreds of thousands of product items that needs to be made accessible to all your e-commerce site's visitors. Are the data required to be very secure? How many database connections do you anticipate? Your actual requirement will determine what type of database is best suited for you.

Some Technical Basics

In order to connect a database to your web site (or vise versa), certain server components called "middleware" are required. These components are necessary for the web server to communicate with the database. It is ideal for the site administrator to have a certain degree of familiarity with technologies like Perl, PHP, Java, or ASP. These technologies are normally used for developing middleware.

A middleware program acts as middleman that translates the user requests (sent via the web browser) to the database. After the middleware receives the data from the database, it again acts as a middleman that translates all that data, formats it accordingly, and finally presents it in a pre-defined fashion as a dynamically-generated HTML page

Continued On Next Page >>

Back to Articles Index Page


About the Author:
Peter Go owns and operates Icthus.Net Communications. CGI City is one of several web sites developed by Icthus.Net Communications.

Articles contained herein are copyright © CGI City unless stated otherwise.


Search For:
Quick jump to
Home | About Us | Contact Us | Link To Us | Search
Tips & Tutorials | References | Books | Add A Resource
Custom Programming Services | Advertise
Disclaimer | Privacy Policy

Copyright © 1998-2099    CGI City    All Rights Reserved
All original materials contained herein including text, images, and original scripts written by CGI City, are copyrighted by CGI City. All other scripts and materials are copyrighted by their respective authors/owners.