How to create a local DSN (Data Source Name)

This tutorial shows you how to set up a LOCAL Data Source Name, or DSN. This means that if you set up a connection on your own home machine then you will be able to connect to the database though if you move your code and database onto a live internet websever you normally will need the dsn set up by your hosting company's server.

If you cannot get in touch with your hosting company you may want to connect to your database with a DSN-less connection.

Step 1: To create a local Data Source Name, click on Start>Settings>Control Panel >ODBC Data Sources. (On Windows 2000 this will be Start>Settings>Control Panel>Administrative tools>Data Sources)

Step 2: When you see the following box, click on System DSN.

System DSN

Step 3: After clicking on System DSN, there may already be System DSN's created on your machine, as you can see below.

DSN

Step 4: Click on the Add tab and the following box will appear.

Microsoft Access Driver

You now need to select the driver depending on which database you are using. As we are going to use Microsoft Access the driver type that you should select is the one that is highlighted above. Next click finish.

Step 5: The following box should appear.

DSN setup

Type in a name that is easily remembered and relevant to your website or database.

Step 6: Click on the select tab.

Database name

After hitting the select tab browse to your local database file and click on the 'OK' button. You have now created a DSN which will come in handy when you try to connect and retrieve information from your database.
Now that you have set up a DSN here's the code again on how to use the DSN.


Previous: Connecting to a database with a DSN

Advertisements



MembersPro

MembersPro PayPal - ASP Membership software

Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.

Get your best asp web hosting provider now and save 25%