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 (continued)
Article by: Peter Go

Flat Files vs. Relational Databases

One way to store data onto your web server is by using flat files. ZDNet Webopedia defines flat file as "A relatively simple database system in which each database is contained in a single table. In contrast, relational database systems can use multiple tables to store information, and each table can have a different record format. Relational systems are more suitable for large applications, but flat databases are adequate for many small applications."

Advantages of using Flat Files:

  • Cheap - using a flat file costs practically nothing because data is stored as text files. No software is required other than the program that needs to access the data.
  • Platform Independent - since text files are universally accepted by all server platforms, there is no problem moving your database from one server to another.
  • Very Simple To Understand - how hard would it be to understand that records in a flat file are stored in one straight line and are separated by delimiters?

Disadvantages of using Flat Files:

  • Low Reliability & Integrity - flat files are very prone to data corruption especially if the size of the database grows beyond what the server resources are prepared to handle. Keep in mind that if your flat file database holds 50,000 records are constant updates are being made, you take a very big risk that your flat file will get corrupted if the server does not have enough resources.
  • Low Security - no security feature is built into a text file. It can be opened for viewing by anyone who happens to know where to look.
  • Limited Data Structuring - as mentioned a while ago, records are stored as lines of text. This does not offer the flexibility or creating "relationships" between data whether within one flat file or across several.
  • Difficult To Integrate With Other Programs - once a flat file is created for use by one program, it is impossible to have another turnkey program use it. This is because the succeeding programs need to conform to the structure of the flat file.

The other side of the paradigm is the use of a relational database management system (RDBMS). Relational databases store data as related tables. Relational databases are more powerful and efficient because they require few assumptions about how data is related or how it will be extracted from the database. As a result, the same database can be viewed in many different ways. An important feature of relational systems is that one database can be spread across multiple tables. This differs from flat-file databases wherein each database is self-contained in a single table (or file).

Advantages of using Relational Databases:

  • Structured Query Language - or SQL is a standardized query language for requesting information from a database. SQL allows for the creation of reusable operations and queries called "stored procedures" which are stored in the database server. These stored procedures are compiled hence there is no need to parse the queries whenever they are executed resulting in more efficient (faster) query results.
  • Supports Large Amount Of Data - relational databases are designed to be able to efficiently handle larger amounts of data compared to flat files.
  • High Security & Reliability - security features such as password and user levels are usually built-in. Database records are also "locked" whenever they are accessed by a user hence preventing data corruption if and when a second user accesses the same record.
  • Optimized Performance - relational databases are able to take advantage of a hardware platform's architectures such as parallel processing or clustered environments.
  • 3rd Party Support - there are many 3rd party tools offered to the users to simplify database management such SQL wizards.

Disadvantages of using Relational Databases:

  • Complex - relational database management systems requires database administrators to manage them. To become one, an individual needs to have a high proficiency in SQL, RDBMS concepts and security.
  • Expensive - Relational databases are mostly (but not all) commercial and requires the users to purchase software licenses. Additionally, they require more server resources plus the proficiency of a database administrator to maintain/manage the system.

Available Products

After determining your requirement and available resources, you would probably want to shop around for available solutions. Important points have been outlined above. Choosing a database product for your needs should further take into consideration factors like what company developed the product, how big is the user group, and what support mechanism does the developer offer.

  • Flattext - A very user-friendly flat file database management system. The developer makes it very easy to customize the flat file management program through the use of wizard-like HTML forms. Recommended for novice webmasters who wish to implement a small-scale database system.
  • MySQL - is a true multi-user, multi-threaded SQL database server that is downloadable for free for use on non-Microsoft platforms. For use under Microsoft operating systems (Win95/Win98/WinNT/Win2000), you need a MySQL license after a trial period of 30 days. Recommended for more advanced webmasters. Available for Unix, WinNT and a variety of other operating systems.
  • Oracle - offers commercial database management software along with the appropriate programming tools to develop your web applications. Apart from database systems, Oracle also offers a suite of turnkey web applications. Oracle is the world's leading commercial database vendor. Available for Unix, WinNT and a variety of other operating systems.
  • Sybase - also offers commercial database management software. Sybase's strength is in its open architecture which allows program developers to author applications that easily integrates with the Sybase database. Available for Unix, WinNT and a variety of other operating systems.
  • Microsoft SQL Server - is a robust RDBMS solution offered by the makers of Windows. This software is available for Microsoft-only operating systems.

Other Considerations

Check the configuration of the web server where you intend to run your database-driven web site. If you are using a hosted account, you may want to ask your server admin if you are allowed to install a database software into your account. Some web hosting companies already offer access to a shared database software. Ask about their acceptable use policies and the extent by which you will be able to use their resources. Remember, a hosted account always shares resources with other clients so better work with your web host to determine your requirements versus their capacity.

The recommended route to take is to acquire your own dedicated web server (whether leased or co-located). With a dedicated server, you will have better control over the resource allocations like server memory, disk space and what software to install.

Overall, weigh and study all your options carefully and the benefits will surely outweigh the difficulties and obstacles involved in setting up your web database.

<< Back To Page 1

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.