facebook  linkedin  Twitter  skype  Rss googlePlus

DSN-less Applications

Nov 28 1999

So you don't want to create a DSN on the machine that your web app is installed.
What benefits can you get from this? Say you have a website on a Virtual Provider
and you just created that new database app and you want to test. Well you have to
email your VP's support to create the DSN and make sure you spell everything correctly
so they don't create something that you don't want. Another example is connecting
to a database dynamically and opening it in your code (I'll be going over this
in a future function in detail

First the absolute minimum is to tell ADO where your database is located and
what driver to use. Being that the database is located on the machine we're talking
a file based database, hence we'll use Access.

In your Global.asa or any file for that matter, just build the following string
and assign it to a variable.

DBConnConnectionString = "DBQ=c:\MyDB.mdb;Driver={Microsoft Access Driver(*.mdb)};"

'once your string is built then use it to connect and open the database.

Set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open DBConnConnectionString

You can pass all the parameters you specify in ODBC manager.

FIL=MS Access;

Use this utility to generate a DSN for your ASP script just enter the path to
your Access database located on your web server and then click on the Generate button
to create your DSN.

Enter full path and name of Access database:


Cut & Paste into your ASP code:




About the Author, Patrick Santry

Patrick Santry, has two decades of experience in enabling businesses to take advantage of the digital landscape. A well rounded experience in technology, and business is what sets me apart from the rest of the pack. When it comes to an overall digital strategy my experience is impressive.

BS in Computer Information Systems. Four time recipient of the Microsoft MVP Award, and author of several books and magazine articles on digital technologies.

blog comments powered by Disqus


Thank you for visiting our site, before you leave, please visit some of the areas or information you may have missed.

Popular Articles