Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Adobe Dreamweaver

The First Step in Connecting Your Database to the Web

📄 Contents

  1. Creating a Data Source Name (DSN) Entry
  2. About this Article
Before you can build pages that are database driven, you must first establish a connection between your Web server and your database. In the Windows operating system, this process is relatively straightforward, but there are several potential pitfalls that can keep your pages from effectively communicating with your database. This article shows you the step-by-step process of setting up a data source name for your database.
This article was excerpted from Inside Dreamweaver UltraDev, by Sean Nicholson.
Like this article? We recommend

Like this article? We recommend

Creating a Data Source Name (DSN) Entry

After you have built your database and have it located on your Web server, the first step in building your database-driven site is to create an avenue of communication between your Web server and the database. While this can be accomplished using drivers designed specifically for your flavor of database, it is much easier to use the Open Database Connectivity Driver (ODBC) or the Java Database Connectivity Driver (JDBC) to accomplish the task.

ODBC and JDBC are standards that have been developed for communicating with modern databases. Most of today's databases, including Access, SQL Server, and DB2, are capable of using the ODBC driver. Other databases are capable of using the JDBC driver. For instance, MySQL can either use the standard JDBC driver or connect through the ODBC driver using an additional program called MyODBC.

How Many Drivers Do You Need?

Tip: An ODBC or JDBC driver must be set up for each database that you want to connect to the Web.

UltraDev also requires that you have the most recent ODBC drivers available in order to function properly. If you have not already installed the latest Microsoft Data Access Components (MDAC), I highly recommend that you take a moment and download them from http://www.microsoft.com/data and install them on your workstation.

Article Exercise: Establishing an ODBC Data Source for Your Database

  1. Setting up an ODBC data source on your workstation differs among operating systems. If the machine that you set up as your Web server is a Windows 9x machine, click Start/Settings/Control Panel. In the Control Panel, select ODBC Data Sources (32bit).

  2. If you are using Windows NT, select Start/Settings/Control Panel and select the Data Sources (ODBC) icon.

    If, however, your machine is using Windows 2000, you should select Start/Settings/Control Panel and choose the Administrative Tools icon. Within the Administrative Tools window, choose the Data Sources (ODBC) icon.

  3. Choose the System DSN tab from the ODBC Data Source Administrator dialog box, shown in Figure 1, and click the Add button.

    Figure 1 The System DSN tab allows you to create a data source that can be shared on the Internet.

  4. Using a System DSN

    Caution: To make a database available to your Web page visitors, you must create the ODBC source under the System DSN tab.

  5. Select the Microsoft Access driver and click Finish.

  6. In the ODBC Microsoft Access Setup dialog box, shown in Figure 2, type the name you wish to use for your data source name in the Data Source Name field.

  7. Figure 2 The ODBC Microsoft Access Setup box.

  8. In the Database panel of the ODBC Microsoft Access Setup dialog box, click the Select button.

  9. Navigate to the location of your database on your Web server and click OK.

  10. Click the Options>> button located in the lower-right corner of the ODBC Microsoft Access Setup dialog box. In the Page Timeout field, type 5000.

  11. Changing the Default Page Timeout

    Caution: It is especially important that you change the default page timeout setting if you are using Windows 2000 as your Web server and an Access database. Failing to change this value can result in permission problems when accessing database-driven Web pages. For more information on this potential problem, visit http://www.macromedia.com/support/ultradev/ts/documents/80004005_win2k_error.htm.

  12. Click OK to close the ODBC Microsoft Access Setup dialog box.

  13. As shown in Figure 3, the ODBC Data Source Administrator dialog box now shows a data source for your database.

  14. Figure 3 A data source has been created for your database.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.