Solved

Server MapPath with direct address

Posted on 2002-05-09
9
475 Views
Last Modified: 2011-08-18
   Having a problem connecting to an access database on a second server with that server's direct address.

Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open "DBQ=" & Server.MapPath("\\Server2\ServerDBs\TestDB.mdb") & _
 ";Driver={Microsoft Access Driver (*.mdb)}"
           
 
    The ASP program is running on Server1 and gives the following error

Server.MapPath() error 'ASP 0174 : 80004005'
Invalid Path Character(s)
An invalid '/' or '\' was found in the Path parameter for the MapPath method.

    How can I connect to \\Server2's database.


 
0
Comment
Question by:JerryPope
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 5

Accepted Solution

by:
dgorin earned 150 total points
ID: 7000589
First, MapPath converts a url to a physical path.  You are already dealing with a physical path, just on a different computer.

There are many pitfalls with connecting to an access db on a separate machine, mostly permission related.  Your web server usually runs in a local user account on the server, so you need to create an identical user on the 2nd computer with the database and give it appropriate permissions.  You can find more on this subject on the Microsoft website.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 7001360
The easiest way to do this is to map the drive containing the database to the server hosting the site. That way, you avoid a whole series of complications with paths and permissions.

Fritz the Blank
0
 

Expert Comment

by:jerry2yu
ID: 7001522
Hi JerryPope,

Try to replace \ with \\

That will be

Set objDC = Server.CreateObject("ADODB.Connection")
objDC.Open "DBQ=" & Server.MapPath("\\\\Server2\\ServerDBs\\TestDB.mdb") & _
";Driver={Microsoft Access Driver (*.mdb)}"
           

   
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 7001586
I could be wrong, but I am reasonably sure that Jerry2U's solution won't work because of permsissions issues. In order for the connection to function, the IUSR and IWAM accounts of the machine hosting the site should have Read/Write priviledges to the directory holding the database. If you map the drive, that will be easy enough. If you follow Jerry2U's approach, you will need to duplicate the IUSR and IWAM accounts with the proper machine name and etc. on the second server. While this is possible, it is not for the faint of heart.

Fritz the Blank
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 7001679
In order to connect a IUSER_ to a remote server, the account needs to be duplicated on the remote server, read here for all the details;

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q184566
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 7001696
Marki,

What's your take on mapping the drive versus duplicating the IUSR account?

Fritz the Blank
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 7001706
Even if you map the drive, the remote server will not recognize the IUSER_ account, something to do with ACL's or something...
0
 
LVL 5

Expert Comment

by:dgorin
ID: 7001729
All of which is what I said.


0
 

Author Comment

by:JerryPope
ID: 7003462
Hello dgorin

    Your statement about MapPath converts to a physical path lead me to the below solution.

objDC.Open "DBQ=\\Server2\ServerDBs\TestDB.mdb;"

   Thank you,
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question