Results 1 to 13 of 13
  1. #1
    Join Date
    Feb 2004
    Posts
    41

    Unanswered: 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.

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618

    Re: Error connecting to DB

    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.....

  3. #3
    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?

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    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.

  5. #5
    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.

  6. #6
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    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 21:08.

  7. #7
    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.

  8. #8
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Not really that strange. The FTP settings do not really have anything to do with the web site settings.

    Who are you hosted through??

  9. #9
    Join Date
    Feb 2004
    Posts
    41
    fdn.com

  10. #10
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Having a look on their site there is nothing useful regarding the way they have set things up unfortunately.

    Good luck.

  11. #11
    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.

  12. #12
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    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,...

  13. #13
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •