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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to a MS Access DB, how to use a relative path.

Status
Not open for further replies.

Mark2000

Programmer
Jun 6, 1999
6
US
I'm connecting to a MS Access Database using Visual Interdev 6.0. I'm running MS Personal Web Server on my Windows 98 development machine. I'm able to create a data connection using the actual path on my development computer. I'm sure how to create a data connection using a relative path. I need the syntax to use the UNC path to the database on the web server.<br>
<br>
Thanks, Mark
 
I use the UNC method when using Access97 linked tables from another database. Instead of using the drive letter like K:, I use \\IMSHXFS1\PUB/ and the rest of the path. This allows remote users to access the data regardless of the drive letters.<br>
<br>
<br>

 
Per the MS Knowledge Base, The drivers don't work correctly without a real drive letter, no UNC'c allowed. And it has to be on the same machine, nothing mapped to a net drive. That means if your development machine is not your http: server, you need to have a copy on both (if you want to see things in the data view.) Remember, id you change data with you web, it won't be changed in the data view in interdev because you changed the copy on the server.
 
Here is some code I use on my NT workstation and a low-volume test Win2000 machine. This uses mappath to convert a relative path to a fully qualified path. The mdb file is in the same directory as the html. This is not a good production choice as people could easily download your database.<br>
<br>
var conntemp=Server.createobject("adodb.connection");<br>
var cnpath="DBQ=" + Server.mappath("TreeThing.mdb");<br>
var conString = "DRIVER={Microsoft Access Driver (*.mdb)}; " + cnpath;<br>
conntemp.Open(conString);
 
I am a little new to VI and I'm forced (for the moment) to using MS Access.&nbsp;&nbsp;Which is the correct way to connect to the DB from a page?&nbsp;&nbsp;I think I have it right... Using a DSN on the server and a DSN on my machine mapped to the DB on the server.<br>Is this correct or can I use OLEDB?<br>BTW: it's MS Access 97.&nbsp;&nbsp;or should I use 2000?<br><br>Gary
 
Gary,<br><br>&gt; Is this correct or can I use OLEDB?<br><br>That should work providing the Access file's folder has write permission in both IIS and NT. In NT the write permission needs to be granted to the IUSER_XXXXX account that the IIS install defaults to, or the one you are using.<br><br>&gt; BTW: it's MS Access 97.&nbsp;&nbsp;or should I use 2000?<br><br>Both should work. I would use 2000 if it is available to you. Of course SQL Server is much better to work with if you can work that out.<br><br>Good luck<br>-pete<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top