
Creating System DSNs
A Data Source Name, or DSN, is how you reference
your database in your ASP applications. The DSN describes important information
about your database, including the path where it resides as well as the ODBC driver that
should be used to access it.
Creating a System Data Source Name for a database is an easy
task with the ODBC Control Panel. It is accessible through the "Database
Tools" link in the Control Panel.
Adding a DSN
The following information is needed to successfully create a
System DSN for your database:
- DSN Name
- Database Name
- Database Type
You should set the DSN name to something that will reflect
which particular database you are configuring the DSN for. Please note that you will
need to refer to your DSN in the format userid.[DSN Name] in your applications
(where userid is your account's User ID). The database name is the path to
the database on your site for Microsoft Access and Microsoft FoxPro databases. For
Microsoft SQL Server databases, enter your username as the database name. You will
also need to specify what type of database you are using: Microsoft Access, Microsoft
FoxPro, or SQL Server.
The first thing you will see in the Database Tools control
panel is the ODBC Data Sources list. From here you can see information about the
System DSNs that have already been created and add new System DSNs. To create a new
DSN, click on the "Add New Data Source" button.
Now you will see the Data Sources form. This where you
can enter all the information required to configure your DSN. If you wanted to
create a DSN called "myDB" for an Access database called "my.mdb"
residing in the "data" directory of your site, you would fill out the form as
illustrated below.
Clicking on the "Insert" button will
add the DSN to the server and you will be taken to the "Feedback" form.
Here you can review the the configuration for the DSN you just set up. You will also
have the option of creating another new DSN or going back to the ODBC Data Sources List.
Modifying or Deleting a DSN
If you have already created a DSN, you will have the option
of changing the database name or deleting the DSN altogether. From the ODBC Data
Sources list, you can select an individual DSN by clicking on it's number.
Now you will be able to change the name of the
database in the in the textbox. The change will be made on the server upon
clicking the "Update" button. You can also delete the DSN by
clicking the "Delete" button.
Notes
- Remember that you must reference your DSN as userid.[DSN
Name].
- Your database must be stored in the "data" directory
of the site if you want to allow write access in your web applications. By default,
in order to protect your databases, the /data directory is configured to deny all web
requests.
Back to Main Menu |