Solved

Server MapPath with direct address

Posted on 2002-05-09
9
473 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
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/…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

22 Experts available now in Live!

Get 1:1 Help Now