If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Error connecting to DB

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-09-04, 12:33
mturner mturner is offline
Registered User
 
Join Date: Feb 2004
Posts: 41
Error connecting to DB

Hi,

I am trying to connect to an Access db on my webserver. I uploaded the database to the correct directory, but it won't allow me to connect to the db.

Here is the code snippet I am using to make the connection:

set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("/cgi-data/costa.mdb"))

Here is the error that is generated:

Microsoft JET Database Engine error '80004005'

'D:\inetpub\mikecosta\web\cgi-data\costa.mdb' 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.

/newhome/admin_delete.asp, line 11

The "cgi-data" directory where I loaded the db is on the same level as the "web" directory where the rest of the files go. Even though I uploaded to the cgi-data directory, I can't seem to access it.

Can someone help me please? Thanks.
Reply With Quote
  #2 (permalink)  
Old 03-09-04, 17:09
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Re: Error connecting to DB

Quote:
Originally posted by mturner
'D:\inetpub\mikecosta\web\cgi-data\costa.mdb' is not a valid path.

The "cgi-data" directory where I loaded the db is on the same level as the "web" directory where the rest of the files go.
So is the full path to the database

D:\inetpub\mikecosta\web\cgi-data\costa.mdb or is it
D:\inetpub\mikecosta\cgi-data\costa.mdb

because you say the cgi-data directory is on the same level as the web directory.....
Reply With Quote
  #3 (permalink)  
Old 03-09-04, 17:14
mturner mturner is offline
Registered User
 
Join Date: Feb 2004
Posts: 41
It is the second one.

But no matter what I put, it always shows the invalid path with the "web" directory in it. Almost like it is my "root".

But if I am uploading to "cgi-data" directory which is on the same level as the "web" directory, I would think that I would be able to access it as well.

Any ideas?
Reply With Quote
  #4 (permalink)  
Old 03-09-04, 17:50
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
conn.Open(Server.Mappath("../cgi-data/costa.mdb"))

??

Does that work? Have you set up the site so that you can map parent directories?? I think this might be disabled by default.
Reply With Quote
  #5 (permalink)  
Old 03-09-04, 20:00
mturner mturner is offline
Registered User
 
Join Date: Feb 2004
Posts: 41
When I change it, I get the same error message:

'D:\inetpub\mikecosta\web\cgi-data\costa.mdb' 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.

/newhome/admin_delete.asp, line 11

I haven't done anything with the site as far as setup. Not really sure what i would change or look for.

Thanks for any help.
Reply With Quote
  #6 (permalink)  
Old 03-09-04, 20:05
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Hmmm,... looks like it's not allowing you to map the parent path....

In IIS (WinNT unfortunately) you click on the website, right click and go to properties, click home directory, configuration, app options tab, check the enable parent paths check box.

oh, you might try...

conn.Open(Server.Mappath("..\cgi-data\costa.mdb"))

I can never remember if they should be forwards or backwards...

Last edited by rokslide; 03-09-04 at 20:08.
Reply With Quote
  #7 (permalink)  
Old 03-09-04, 20:18
mturner mturner is offline
Registered User
 
Join Date: Feb 2004
Posts: 41
Switching the slashes produced the same error.

I guess I will have to bug the webserver company tomorrow, and ask them about the pathing, that you suggested.

Is it strange that I could FTP the db to the directory, but can't connect to it?

Thanks for your help at anyrate.
Reply With Quote
  #8 (permalink)  
Old 03-09-04, 20:21
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Not really that strange. The FTP settings do not really have anything to do with the web site settings.

Who are you hosted through??
Reply With Quote
  #9 (permalink)  
Old 03-09-04, 21:14
mturner mturner is offline
Registered User
 
Join Date: Feb 2004
Posts: 41
fdn.com
Reply With Quote
  #10 (permalink)  
Old 03-09-04, 21:29
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Having a look on their site there is nothing useful regarding the way they have set things up unfortunately.

Good luck.
Reply With Quote
  #11 (permalink)  
Old 03-10-04, 12:03
mturner mturner is offline
Registered User
 
Join Date: Feb 2004
Posts: 41
Thanks for your help.

I spoke to Tech Support today and it was SOLVED!

It WAS a pathing problem. The corrected code was:

conn.Open("[complete.actual.physical.path.here]")

Originally i had tried:

conn.Open(Server.Mappath("/cgi-data/costa.mdb"))

Again, thanks for helping.
Reply With Quote
  #12 (permalink)  
Old 03-10-04, 15:47
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
not a problem. pity that you couldn't use virtual pathing though. makes it a pain when you develop on one server and then move to another,...
Reply With Quote
  #13 (permalink)  
Old 03-15-04, 20:35
darkform darkform is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
hi there.

I've made a small .asp file for me and it helps me alot when I need the phisical path info.

Just copy and paste the code below to a blank .asp, send it to your space through ftp or whatever and call it from where you put it in. That will mostly show you the real path:


'start copying here
<html>
<head>
<title>Untitled</title>
</head>

<body>
<p><%= Request.ServerVariables("PATH_INFO") %>
<p><%= Request.ServerVariables("PATH_TRANSLATED") %>




</body>
</html>
'end copying here

hope helps to someone
peace,
Baris
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On