Solved

Server MapPath with direct address

Posted on 2002-05-09
9
478 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

690 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