Solved

Server MapPath with direct address

Posted on 2002-05-09
9
474 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now