AspAlliance.com LogoASPAlliance: Articles, reviews, and samples for .NET Developers
URL:
http://aspalliance.com/articleViewer.aspx?aId=435&pId=-1
Creating a DSN
page
by . .
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 15998/ 22

Introduction

Creating a DSN

Introduction

This tutorial will instruct you on how to create a simple DSN connection to an Access database, but the same concepts apply for connecting to any other database through a DSN connection.

Database...Check!

You obviously need a database.  It's good practice that you don't use any spaces in the names of columns or tables.  In Access, they allow you to do this, and when you access the data in a web page, it gets a bit messy. Put the database in any folder--the good thing about DSN's is that you can store the database on a completely different location than the web server, and this allows for added security if you're storing things like passwords or credit card details.

Creating the DSN

DSN...Almost

Now we get to the good stuff... I have provided some helpful screenshots to guide you on your DSN creation.

Go into Control Panel:

Then Administrative Tools:

Then ODBC Data Sources:

Then click on the System DSN tab and click on Add:

You see a bunch of tabs at the top these tabs are different things to do with ODBC. User DSN are DSN's for a specific user, but for a web server you shouldn't create DSNs in here; use them for internal pages for you only. System DSN:  the whole system can see these, and they are ones that everyone that accesses your computer can see.

Choose your driver:

Here you can choose any of the available database drivers on your machine.  Choose the one for accessing the type of database you will be using. If you are running SQL Server, here you choose the SQL Server Driver, and you have to supply server addresses, passwords, usernames, database names, etc.

Set up the DSN:

  1. Enter a Data Source Name; this is what we call your Database, so keep it short and without spaces. eg. myBooks
  2. Click on Select... to browse to the directory where your database is and choose it.  This tells ODBC where to find the DB.
  3. If you set a password for your database, click on Advanced....

Passwords?

Access only supports passwords, not usernames, so just enter the password and click OK.

Click OK to the other dialog and you can see your DSN listed in the System DSN list, and now you can use it to set up databases.


Product Spotlight
Product Spotlight 

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-25 10:36:27 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search