The First Step in Connecting Your Database to the Web
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
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).
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.
Select the Microsoft Access driver and click Finish.
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.
In the Database panel of the ODBC Microsoft Access Setup dialog box, click the Select button.
Navigate to the location of your database on your Web server and click OK.
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.
Click OK to close the ODBC Microsoft Access Setup dialog box.
As shown in Figure 3, the ODBC Data Source Administrator dialog box now shows a data source for your database.
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.
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.
Figure 2 The ODBC Microsoft Access Setup box.
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.
Figure 3 A data source has been created for your database.