HWG Resources FAQs HWG-servers, Database FAQ

How do I get my CGI to talk to my database?

Table of Contents

  1. Introduction
  2. Perl
  3. Cold Fusion
  4. PHP
  5. ASP
  6. Other
  7. For More Information

  1. Introduction

    Most every web site of any size now generates at least some of the content from data stored in some variety of database. This saves the time, disk space, and tedium, of generating hundreds, or perhaps thousands, of HTML pages by hand. With this approach, each document is custom-generated for the needs of the user

    Depending on your platform and expertise, there are a variety of tools available to help you use your databases to generate HTML pages. Here are some of those tools, in no particular order.

    Table of Contents | HWG-Servers FAQ

  2. Perl

    Perl is increasingly the tool of choice in web programming. (To find out more about Perl, see the Perl FAQ.) And database access is no exception to this.

    DBI - the Database Interface - is a database-independent module for Perl database access. The nicest thing about DBI is that once you have written your code, it will run on any database. For example, you might develop an application on Linux with a MySQL database, and then run it on Windows NT with a Microsoft SQL Server database. This greatly reduces the time and cost of development, as you don't have to develop a new application for each platform.

    You can find a great deal of information about DBI at Symbolstone. There is a new book from O'Reilly about DBI, by Tim Bunce and Aligator Descartes, who are two of the primary authors of the DBI packages. You can purchase this book from the HWG Bookstore.

    Table of Contents | HWG-Servers FAQ

  3. Cold Fusion

    Cold Fusion is a product of Allaire, who are also the producers of the fantastic product I am using right now - HomeSite. Cold Fusion runs on Windows and Unix platforms.

    Cold Fusion allows you to put directives directly into your HTML code to query your database. These are processed at the time that the page is served, and so the pates are dynamically generated each time. It is clearly a powerful tool for database access. On the minus side, you have to learn a variant of HTML called CFML in order to write your web pages.

    Table of Contents | HWG-Servers FAQ

  4. PHP

    Another powerful server-side database scripting tool is PHP. Like Cold Fusion, PHP requires that you write scripting directives into your HTML pages, and these pages are then parsed by the server component, to generate your dynamic web pages.

    You can find out more about PHP at the PHP web site, www.php.net.

    Table of Contents | HWG-Servers FAQ

  5. ASP

    ASP, Active Server Pages, is Microsoft's server-side scripting tool. It's yet another language for writing scripting directives into your HTML pages, which are then executed on the server to generate your dynamic HTML pages.

    I'll try to put more here if/when I find a good online ASP resource that comes highly recommended. I don't use them myself, so I'm not the guy to tell you.

    Table of Contents | HWG-Servers FAQ

  6. Other

    There are a large number of other database -> web programs out there. As an employee of a subsidiary of a subsidiary of IBM, I'm more or less required to mention that the Lotus Notes/Domino server does this, but I could not in good conscience recommend that anyone actually use the beast. However, I've heard really good things about the 5.0 version, due out later this year.

    Table of Contents | HWG-Servers FAQ

  7. For More Information

    I'm working on an online CGI database tutorial, which focuses mainly on Perl database connectivity methods. If you know of other good CGI/Database tutorials, please let me know.

    Table of Contents | HWG-Servers FAQ


[Valid HTML 4.0!]
This page is maintained by hwg-lgmanager@hwg.org. Last updated on 23 October 2003.
Copyright © 2003 by the HTML Writers Guild, Inc.