Learn Microsoft Access Advanced Programming Techniques, Tips and Tricks.

Friday, April 20, 2007

Create a DSN connection


Creating a DSN Connection

At this point, you need to create a data link. When you execute an ASP file, Windows must know which database you're connecting to. An ODBC Data Source Name (DSN) simply stores the information(the name, the path, the user, and the password) required to connect to a specific database. OLE DB connections are superior to DSN because they're quicker to connect, but you must include the specific connection string in the script, and that's beyond the scope of this article. A DSN connection requires a little know-how to set up. There are two types of DSN.

System: A System DSN is available to all users on the system and is the one to use when you want others to access a DSN connection via the Web. For this article, it is vital that you use a System DSN created on your Web server or local development system.

File: All users who have the appropriate drivers installed can share a File DSN. A driver is a bit of software that provides a specific functionality, such as a connection to a data store, a sound card, and so on.

The main difference between the two types is that a File DSN is not available to the public, while the System DSN is available to all users of the machine, including the Web server.

To create a DSN on a Windows 98 system:

  1. Open the Control Panel and double-click the ODBC Data Sources(32-bit) item.
  2. Click the System DSN tab.
  3. Click the Add button. Select the Microsoft Access Driver(*.mdb) item and click Finish.
  4. When prompted, enter a name for the DSN. For the sample, enter NorthwindDSN.
  5. Enter a description for the connection.
  6. Click Select to locate your Access database. Find and select the sample database \inetpub\wwwroot\sample\Northwind.mdb
  7. Click OK to create your DSN. Notice that the new DSN is added to the System Data Sources list in the ODBC Administrator.
  8. Click OK one last time and close the Control Panel window.

To create a DSN on a Windows 2000 system:

  1. Open the Control Panel and double-click Administrative Tools.
  2. In the resulting folder, double-click Data Sources (ODBC) to open the OBDC Data Source Administrator.
  3. Select System DSN, then click Add.
  4. Scroll through the list of drivers and select the Microsoft Access Driver. Click Finish.
  5. Follow steps four through eight for the Windows 98 instructions.

Click Next for connect-to-the-database

  1. Installing the Personal Web Server (PWS)
  2. or Internet Information Services (IIS)
  3. Create the Example ASP Files
  4. Create a DSN Connection
  5. Connect to the Database
  6. Modify Access Data Online
  7. Inserting Data
  8. Modifying Data
  9. Deleting Data
  10. Data Insert Form

No comments:

Post a Comment

Comments subject to moderation before publishing.

Powered by Blogger.