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

Connection Problem with Server.Mappath

Status
Not open for further replies.

IndyGill

Technical User
Joined
Jan 15, 2001
Messages
191
Location
GB
Hi

I am using UD4 on a Windows 2000 box with IIS 5. I am creating some ASP pages using VBscipt. I have set up a site, defined the application server and URL Prefix.

The Problem
I have a page that pull out a few field from a database table. The page works fine when I use an ODBC connection however I want to use a Connection String which usues Server.Mappath it doesnt. I have created a new Custom Connection String in Ultradev setting it to "Using Drivers on Application Server" the connection string is:

"Driver={Microsoft Access Driver (*.mdb)};Dbq=" + Server.Mappath("..\admin\data.mdb")

When I Test the connection in Ultradev the connection is successful. I can also create a recordset, however when I view the page in a browser I get the following error:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
/bht/test.asp, line 5


Line 5 is= rsTest.ActiveConnection = MM_myconn_STRING

Any help would be much appreciated

Thanks in advance

Indy
 
Hey Indy,

I have not run a server as of yet. But I believe it depends on how you have it set up. With a commercial site I do - dsn="hondas" works perfectly. On other's I need a path such as you did. And even others if I have the full path it works great.

Here are a couple methods. Change the gvff and Nato to what you need.

This one requires the correct ODBC set up.
<%
' FileName=&quot;Connection_odbc_conn_dsn.htm&quot;
' Type=&quot;ADO&quot;
' HTTP=&quot;false&quot;
' Catalog=&quot;&quot;
' Schema=&quot;&quot;
MM_gvff_STRING = &quot;dsn=Nato;&quot;

This one you have to change the whole path.

<%
' FileName=&quot;Connection_ado_conn_string.htm&quot;
' Type=&quot;ADO&quot;
' HTTP=&quot;true&quot;
' Catalog=&quot;&quot;
' Schema=&quot;&quot;
MM_gvfforce_STRING = &quot;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=e:\domains\yourdomain.com\user\htdocs\nato\dbase\gvfforce&quot;


To find the full entire big honkin path to your database. create a test page. Put this in the body

<%Response.Write(&quot;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=&quot; & Server.MapPath(&quot;gvfforce&quot;))%>
and save the file right where your database resides.

Then type that page's address in the browser

&quot;If you feel a post has been helpful to you, click on the link at the bottom of their post to cast a vote for &quot;TipMaster Of The Week&quot;. You don't need to be the one who asked the question to vote&quot;

Stuart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top