Internet Database Connector Examples

This page provides links to several examples that use the Internet Database Connector. Although the Internet Database Connector can use any 32-bit Open Database Connectivity (ODBC)-compatible driver that supports System Data Source Names (DSNs), these examples use Microsoft® SQL Server.

For the examples to run without modification, the Microsoft SQL Server sa account must be accessible from your computer and the sa account must have no password requirement. (This is the default installation for Microsoft SQL Server.) If you cannot or do not want to use the sa account for these examples, you can edit the Username field (and add a Password field if necessary) in the .idc files used in the examples to a valid user account.

To set up these examples, create an ODBC system data source named Web SQL on thecomputer that will connect to the SQL server. Use the ODBC program in Control Panel to create the system DSN, or click here to create it using one of the ODBC datasource tools provided with Microsoft Internet Information Server and Peer Web Services. Creating ODBC data sources from Control Panel is described in Chapter 8 of Installation and Administration Guide.

Once the Web SQL data source has been created, you can try the following examples.

Sample Guestbook Application

A guestbook is a Web application that visitors to your site can use to leave their names and comments. This application also provides a way for users to query over (search) the entries stored in the guestbook.

Before using the guestbook, your must first create a table using the Web SQL ODBC system DSN for Microsoft SQL server described above. The guestbook data will be stored on the SQL Server. You only need to do this once.

Once you have done so, you can use the Guestbook.

If you want to create a guestbook application for your site, or just want to learn more about the Internet Database Connector, see the Internet Database Connector files (the filename extensions are .idc and .htx) used in this application for ideas. They are installed under the /scripts virtual root, in the Samples subdirectory (\Inetsrv\Scripts\Samples, if you chose the defaults during setup).

Other Database Examples

The following examples require that the "pubs" sample database be installed on the SQL server being accessed.

  Simple database query

 Query driven by a form

 Query that returns data as hyperlinks

 Logging to a Microsoft SQL Server Database

You can send server activity logs to a database to automatically analyze server activity and to generate reports. To configure either Internet Information Server or Peer Web Services to log to a Microsoft SQL Server database, click here.

Note that database logging increases the amount of time and resources required to respond to Web, File Transfer Protocol (FTP), and gopher requests. For maximum performance, sites with heavy traffic should create log files rather than logging to a database.