Internet Database Connectivity

Tim Dainels explains how to access your database to wake up your Web pages and make your job easier.

Tim Daniels

June 30, 1996

4 Min Read
ITPro Today logo

Wake up your Web page

If your Web server is part of your business solutions, you'd better have adatabase engine connected to it--or you're toast. Without database connectivity,personalizing and customizing your Web presence is an overwhelming task, and "personalize,customize" is now the Webmaster's mantra.

In case you haven't heard, static Web pages are about as exciting asLawrence Welk's 20-year reunion show. To see how database connectivity can jazzup your Web page, look at the Microsoft Network home page, www.msn.com.

"So what," you say. "I'm just setting up a corporateintranet. All I want is our company phone list and maybe some employee benefitsinformation on a Web page. Why do I need a database?"

Well, go ahead and create Web pages for every possible phone list andemployee benefit. But can't you just hear your users soon demanding thecapability to search by first name, or maybe department, or last name, and onand on? Then your company has a hiring spree, and you're spending so much timeupdating your static pages that you can't handle all the new requests, includinga new job posting page and a 401K page complete with pie charts and bar graphsto plot progress.

So what's the answer? Database connectivity. With a database managing allthe information and with a database connectivity product such as WebBase or CGIPerForm, you can dynamically display information any way you or your users seefit.

Connecting a database to a Web server is pretty easy. Many availablepackages make it as easy as installing Web server software. We reviewed two ofthese packages (see "dbWeb 1.0 and Cold Fusion 1.5," WindowsNT Magazine, April 1996). Microsoft purchased dbWeb after our review,and will release it as Microsoft dbWeb. Two other outstanding packages are CGIPerForm (visit http://www.rtis.com/w3toolkit/perform)and WebBase by ExperTelligence (at >http://www.webbase.com).Open Database Connectivity (ODBC) lets all these packages provide excellentdatabase integration and connectivity. Standard ODBC drivers that come with NTand most database engines let WebBase support more than 50 databases.

So how does database and Web connectivity work? All these databaseconnectivity products have unique charms, but most work the same way.

Let's take WebBase, retrieve some information from a table, and display itas a dynamic Hypertext Markup Language (HTML) page. This example works with astandard Web page that asks users to input an employee name (such as Denny) tosearch for. This page is created with standard HTML, except that the Submitbutton does the following GET request from the WebBase server:

http://test.com:80/getname.htf?name=Denny

The special file GETNAME.HTF controls how to query the data and how you wantto store the returned information. Here's an example .HTF file:

{sql to answers source 'Primary'
user 'Administrator'password
'Secret' max 25}

SELECT * FROM Examples where
name LIKE '%(name)%''

{/sql}

{forRow aRow on answers}

Name:{Name}

Extension:{Extn}

Email Address:{Email}

{/forRow}

WebBase substitutes the variable Denny for (name) and performs theSQL select from the Companies table of the Primary ODBC data source. The querywill return up to 25 records. This feature is very important--as you know if youever get a query that returns 10,000 records. Imagine building that Web page at14.4Kbits per second!

Next, theforRow construct loops through the results. The variable aRowtakes on each result as the query returns it. For the place holders {Name},{Extn}, and {Email}, WebBase substitutes the values that the query returns fromthe table. Now you have Web database connectivity.

You don't need a quad-processor Alpha system with 10GB of disk space to runa database engine. A 486 with a modest amount of RAM and disk space will do thejob. For software, start with a readily available product such as MicrosoftAccess. All the software packages I mentioned support Access via ODBC. Thissetup lets you handle simple queries and small databases at low volume, but it'sa start. Once you get a taste of what database connectivity can do for your Webpages, you'll never let your users choke on static pages again.

Off the Shelf
Another product that lets you turn the unintelligible gibberish that is alog file into meaningful information is WebTrends from e.g.Software. Download afull, working, 15-day trial version at http://www.webtrends.com.The only limit is the trial period. You can create reports that vary in styleand complexity: from a simple list of who accessed your Web site and what theydid (translated from a log file into plain English) to full-color 3D bar chartsdetailing users by country, state, and even city. WebTrends also gets asdetailed as you want, providing reverse Domain Name System (DNS) lookup atreport time (so your server doesn't have to waste time doing it). WebTrends alsotranslates those pesky error codes like "403" into meaningful English,like "error 403, failed forbidden." Add event scheduling fortranslating the log files (handy if you have a big site) and extensive filteringcapabilities, and you have a package any Webmaster will give a home page for. Asa matter of fact, if you provide a link from your home page to WebTrends' homepage (http://www.egsoftware.com), thecompany will give you a 50% discount off the list price. For more information,email [email protected].

When your Web server generates terse information in a log file, anotherproduct, DistStat, turns it into statistical information that you can distributeby email to any number of people. If you are hosting pages or Web sites forother businesses or vendors, this tool can be very useful. Get an evaluationcopy at http://www.rtis.com/nat/software/diststat/docs/eval.htm.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like