Creating a Database Connection

FrontPage has offered database connectivity since FrontPage 97. It started as the simple ability to pull information from a database and list it on a page in an HTML table, but as FrontPage has matured, so have the database features it offers. Using the database features available in FrontPage 2003, you can easily store information about the people visiting your site, present an online catalog in an e-commerce store, and so on. Dynamically building content for your Web site using information in a database is a quick and easy way to make your site retain its appeal and freshness.

The database capabilities of FrontPage require a database connection. A database connection consists of information that is necessary to make a connection to your database. The information included in a database connection varies depending on what type of database you are connecting to. For example, if you are connecting to a SQL Server database, the database connection will specify the database server name, the name of the database to connect to, and a username and password if necessary. For a Microsoft Access database, the connection string will contain the path to the Access database, as well as other information as needed.

To add a new database connection, select Tools, Site Settings and click the Database tab. Click the Add button to access the New Database Connection dialog box, as shown in Figure 37.1. After creating the database connection and clicking OK, you can verify it by clicking the Verify button.

Figure 37.1. The New Database Connection dialog box allows you to manage database connections to various data sources.

graphics/37fig01.gif

TIP

FrontPage will display a check mark next to the connection name if it successfully verifies. However, a check mark doesn't necessarily mean that the database connection will work successfully when you run the page. In order to ensure that the connection is a good one, test the page that uses the connection by browsing to it in your Web browser.


NOTE

The New Database Connection dialog box can also be accessed from the Database Results Wizard or Database Interface Wizard by selecting the option to create a new database connection.


The four options for a new database connection are as follows:

  • File or Folder in Current Web Site Connect to a data source using a file in the current Web site.

  • System Data Source on Web Server Connect to a data source using a System DSN on the Web server.

  • Network Connection to Database Server Connect to a Microsoft SQL Server database or an Oracle database using Microsoft's ODBC provider for Oracle.

  • Custom Definition Connect to another data source using a .dsn file, a .udl file, or a custom connection string.

Using a File or Folder in the Current Web Site

To use a file in the current Web site, first import the file in to your Web site. After you've imported the file, select the File or Folder in Current Web Site radio button in the New Database Connection dialog box and then click Browse to display the Database Files In Current Web Site dialog box, as shown in Figure 37.2. Select the file to use and then click OK to add a connection to that file.

Figure 37.2. The Database Files in Current Web Site dialog box allows you to select a file as a data source.

graphics/37fig02.gif

Using a System DSN

To use a System DSN on the Web server, select the System Data Source on Web server radio button and click Browse. Choose the System DSN from the list displayed as shown in Figure 37.3 and click OK. If a System DSN is not displayed for your data source, you can create one using the Data Sources (ODBC) applet in the Control Panel or by contacting your hosting company or server administrator.

Figure 37.3. Use the System Data Sources On Web Server dialog box to select a System DSN.

graphics/37fig03.gif

NOTE

For information on creating a System DSN in Windows XP Professional Edition or Windows Server 2003, see article number 305599 in the Microsoft Knowledge Base (http://support.microsoft.com?id=305599).

For more information on creating a System DSN in Windows 2000, see article number 300596 in the Microsoft Knowledge Base (http://support.microsoft.com?id=300596).


Using a Network Connection to a Database Server

To connect to a SQL Server or Oracle database server, select the Network Connection to Database Server radio button. Click the Browse button to display the Network Database Connection dialog box, as shown in Figure 37.4. Select SQL Server to connect to a SQL Server instance or Microsoft ODBC for Oracle to connect to an Oracle server. If you select SQL Server, enter the name of the SQL Server and the name of the database to use for the data source and click OK. If you select Microsoft ODBC for Oracle, enter only the name of the Oracle server and click OK. If you need to use a username and password to connect to your database server, you will need to click the Advanced button in the New Database Connection dialog box and enter that information in order to successfully use the database.

Figure 37.4. Setting up a connection to SQL Server or Oracle is easy with the Network Database Connection dialog box.

graphics/37fig04.gif

A SQL Server connection might successfully verify when you click Verify, but might not necessarily work when you browse the page. It all depends on what type of authentication is being used on the SQL Server and the configuration of the Web browser and the Web server. In most cases on the Internet, SQL Server requires a username and password. In an Intranet environment, many Web developers rely on Windows to authenticate users to SQL Server. In these cases, a username and password might not be required.

NOTE

For more information on connecting to SQL Server databases, read Microsoft SQL Server 2000 Programming By Example from Que Publishing.

For more information on connecting to Oracle databases, get Oracle 9i Development By Example from Que Publishing.

For detailed information on security and SQL Server, check out SQL Server System Administration from Que Publishing.


Using a Custom Definition

If none of the selections on the New Database Connection dialog box are appropriate for your particular data source, you can use a custom definition to connect to your data source using the Custom definition option. Using this option, you can point FrontPage to a .dsn file or a .udl file. Both files contain connection information to allow you to easily connect to many different data sources.

TIP

To easily create a .udl file to connect to your data source, create a new text document with Notepad and then change the file extension from .txt to .udl. Double-click the new .udl file and the Data Link Properties dialog box will appear, allowing you to easily configure a new .udl file.

Click OK after configuring your settings, and they will be saved in your .udl file and ready for use in FrontPage.


NOTE

For more information on .dsn and .udl files, read Sams Teach Yourself ADO 2.5 in 21 Days from Sams Publishing.




Special Edition Using Microsoft Office FrontPage 2003
Special Edition Using Microsoft Office FrontPage 2003
ISBN: 0789729547
EAN: 2147483647
Year: 2003
Pages: 443

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net