November 17, 2002
DSN-less Connections

I want to create a DSN-less connection to a database on my website.  How do I do it?

You can cut and paste the following snippet of code to create a DSN-less connection.  HOWEVER, unless permissions are changed on the server,  you'll only get a read-only connection.  Make sure your database is in a subdirectory of your main web all by itself, and then contact us at support@atlcon.net  We'll be happy to relax the permissions on that subdirectory so that you can open a read/write connection to the database.  Here's the code for the DSN-less connection (this must be in a file with a .ASP extension):

' First map the path to your database
db = Server.MapPath _
("/~yourweb/data/yourdb.mdb")
'
' Now create a new connection object
Set Conn = Server.CreateObject("ADODB.Connection")
'
' Build the DSNless connection string
strconn="PROVIDER=Microsoft.Jet.OLEDB.4.0;"
strconn=strconn & "DATA SOURCE="
strconn=strconn & db & ";"
'
' Open the database!
Conn.Open strconn

Updated by WebWiz on January 20, 2003
Posted by WebWiz at November 17, 2002 03:07 PM

©2002-2004 zConnect
All Rights Reserved
admin
3600 Dallas Hwy STE 230 PMB288
Marietta, GA 30064-1685
support@zconn.net
770 590-0888
FAX 770 234-6721
Toll Free 1-800-959-8869