MS FrontPage

Adding a Database Connection

Before you can do anything with a databaselike send results to it or display parts of it on a Web page, you first have to establish a connection to it.

Before you connect to a database, it should reside where it belongs. In other words, if you plan to import it into your Web site, do so before connecting to it. (Instructions for importing a database follow below.) Don't connect to a database stored somewhere else on your computer's hard drive. A database must be located in your Web site, or on a network drive or Web server where your live Web site can connect to it. See step 3 within "Creating a Database Connection," next, to read about connection types.

Importing a Database

If your database is going to live inside your Web site, you have to import it before establishing a connection to it.

Not all databases can reside inside your Web site. Some require more space or need to live on a database server, in which case you wouldn't import the database; instead, you'd just create a connection to it.

Select File » Import. In the Import dialog box, click Add File. Browse to and select the database file. Once it appears in the Import dialog box, click OK.

FrontPage also asks if you'd like to create a database connection for the file. This saves you the trouble of manually creating a connection (as explained in the next section). To create the database connection, type a connection name in the Name field and click Yes. FrontPage then asks if you'd like to save the database in your site's fpdb folder. Click Yes again.

fpdb folder

What's this fpdb folder and why does FrontPage insist on saving my databases there?

FrontPage creates this special folder specifically for storing databases. The program automatically makes the fpdb (FrontPage database) folder off-limits to browsers, scripts, and executable files to protect your data. That's why, when FrontPage encourages you to save your data in this folder, you should comply. In fact, if you place a database in some other folder in your site, FrontPage gets agitated and prompts you to move it each time you run a component errors report.

Creating a Database Connection

To connect to a database, follow the steps described next.

If you're connecting to an ODBC data source (Working With Databases), you must register your database within the ODBC Data Source Administrator (located in your computer's Control Panel, within Administrative Tools) before connecting to it in FrontPage. If you're making an ODBC connection, you probably have a system administrator who can do this for you.

  1. Initiate the database connection.

    Click Add Connection within the form results Options dialog box. Or, select Tools » Site Settings and then click the Database tab. The Site Settings dialog box opens. Click Add to display the New Database Connection dialog box.

  2. In the Name field, type the name of this database connection.

    You'll use this connection name each time you want to work with this database in FrontPage. This name saves you the trouble of specifying path information each time you link to the database. For best results, relate the name to the name of the database, don't use capital letters, spaces, or special characters, and don't make it longer than eight characters.

  3. Select the type of database connection you're creating.

    Click on one of the following choices.

    • File or folder in current Web. This is the simplest option. If your database is small enough to store in your site, you won't need to worry about maintaining a connection to a database server.

    • System data source on Web server. Click this if you'll connect to the database using ODBC (Working With Databases).

    • Network connection to database server. If you're connecting to a database through a simple network connection, choose this option.

    • Custom definition. Use this option if you're using text fileslike DSN (Data Source Name) or UDL (Universal Data Link) to connect to your database.

    If a user name and password are required to access the database, let FrontPage know what they are by clicking Advanced and entering them in the respective fields.

  4. Browse to the data source.

    Depending on what type of connection you chose in the previous step, your choices differ after you click Browse.

    • If you chose to connect to a database in your Web site, click Browse and you'll see the files and folders in your site. Browse to and select the database file.

    • If you chose "System data source on Web server," click Browse, and then select the ODBC system data source name.

    • If you chose Network connection, select the type of database server, type in the server's host name, and then type in the name of the database.

    • If you chose Custom definition, click Browse to find and then select the .dsn or .udl file you'll use for the connection.

  5. Click OK five times to close all dialog boxes and save your connection.

FrontPage manages your database connections by recording them in a file called global.asa. Once you create a database connection, you'll see this file in your folder list. You shouldn't open or edit this file.

by BrainBellupdated