Creating database connections from ASP pages
Further information may be found on the Microsoft support site
General Information
In order for your asp pages to get and save information in a database, you must
tell the webserver how to connect to your database.
Additionally, if you intend to write to the database, we must manually
set the permissions on the server to do this.
For best security, we recommend that you create a directory on the same level
as the www\ directory, and place your database in there. Choose whatever name
you wish, 'database' is a good choice
Once you have created the directory and uploaded your database, email
support@wedohosting.com with your domain name and the location of your database,
and we will set the permissions correctly.
If you are not going to write to the database, you may omit this step
The full server path to your database will be, assuming you named the directory 'database':
d:\web\yourdomain.com\database\mydatabase.mdb
DSN vs. DSN-less connections.
A DSN is a Data Source Name, and is a shortcut form used to connect to
a database.
Microsoft is currently recommending that you use DSN-less connections.
If you must
have a DSN (for instance, if you're using ColdFusion) then please email
support@wedohosting.com and we will set up the connection for you.
You will need to provide the path to the database, and your connection will
generally be named yourdomain_com (ie your domain name, with dashes and periods
replaced with the underscore character)
DSN-less connections allow you to start working with your data immediately, and
allow you to create unlimited databases for your use.
Sample Connection Strings
Microsoft Access Without DSN
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=d:\web\mydomain.com\database\mydatabase.mdb"
%>
Microsoft Access With DSN
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open "DSNname"
%>
SQL Server databases require you to be on a web package that supports it.
If you require a database, you will need to email support@wedohosting.com and
we will set up your database, and email you instructions once we have completed
the setup.
Microsoft SQL Server Without DSN
<%
Set Conn = Server.CreateObject("ADODB.Connection")
DSNtest="DRIVER={SQL Server};SERVER=vader.wedohosting.com;UID=USER;PWD=password;DATABASE=mydatabase"
Conn.open DSNtest
%>
Microsoft SQL Server With DSN
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open "DSN=MyDSN;UID=user;PWD=password;DATABASE=mydatabase"
%>
|