Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DSN-less connection strings

Status
Not open for further replies.

lazydays

Technical User
Sep 29, 2003
93
GB
I tend to use DSN-less connections to databases - don't know why, but it just seemed to happen that way!

However, I am designing a site with a datasource directory below the root of the site, and I am having trouble setting up the connection string.

My script is in
root/and my database is in
root/datasources/
Is it possible to connect using a DSN-less connection to this database?
If so, can someone help me please!!!! :)
 
I don't know how to define the connection string.

I thought that the following string would work but it couldn't connect.
objConn.ConnectionString = "DRIVER {Microsoft Access Driver (*.mdb)};
DBQ=" & Server.MapPath
("../datasources/
Any pointers would gratefully received!
 
shouldnt ../datasources/www.domainname.com/database.mdb just be ../datasources/domainname/database.mdb??

Tony
________________________________________________________________________________
 
I have tried that Tony but still no joy [sad]
Any other ideas?
 
Try this:

<% ' ASP server-side code
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=" & Server.MapPath(".") & "\myDb.mdb;" & _
"Uid=admin;" & _
"Pwd="
%>

This assumes the MDB is in the same directory where the ASP page is running. Also make sure this directory has Write permissions for the user account.

taken from able-consulting.com

-VJ
 
Maybe I'm missing some technical facts here, but the hierarchy of your directories/folders looks a little confusing to me. I have a suggestion though.
Use the local path of the database file directly. For example, if your database file is located in C:\INETPUB\DATASOURCES\DOMAINNAME\ folder, use this connection string:
Code:
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
      "Data Source=c:\inetpub\datasources\domainname\database.mdb;"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top