MS Access can't open file

Discussion in 'ASP .Net' started by semesm22, Dec 12, 2005.

  1. semesm22

    semesm22 Guest

    hello all, i am using asp.net with IIS on a Windows XP machine to open
    an Access database, and i know that this topic has been posted on forums
    hundreds of times, but i can't find an answer that works..

    here is the problem, i m opening the database with OleDBConnenction and
    OleDbCommand...but i get this error:

    The Microsoft Jet database engine cannot open the file
    'C:\Database\database.mdb'. It is already opened exclusively by another
    user, or you need permission to view its data.

    HOWEVER, when i put the database in D:\Database, it works just
    fine.....i researched the forums to find an answer, i even found a topic
    on MSDN, but that related to server based IIS, and not WIN XP, it was
    talking about permissions to everyone, which is something not found on
    WIN XP....the problem is that i am doing this for a college assignment,
    and i need to hand in the database in the same folder that contains my
    web forms and web.config and all that.....i tried to use
    Server.MapPath("..\Database\Database.mdb"), but that also didn't
    work....can anyone help please...

    thanks

    --
    Sent via .NET Newsgroups
    http://www.dotnetnewsgroups.com
    semesm22, Dec 12, 2005
    #1
    1. Advertising

  2. You need to give the account your website is running as (it could be
    IIS_User or ASPNET depending on whether you have an Identity Impersonate tag
    in your web.config file or not) read and write permissions to the folder
    that your database is in. To do so navigate to that folder, right click on
    it and click properties. If you don't see a "Security" tab in the properties
    window for that folder you'll need to reveal it (It's hidden by default on
    Windows XP). To reveal the security tab in a folder browsing window click
    Tools - Folder Options and then click on the "View" tab. at the very bottom
    of the Advanced settings list uncheck "Use simple file sharing"

    Then when you right click a folder and choose properties you'll see a
    "Security" tab where you may set the permissions.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "semesm22" <> wrote in message
    news:OyN2EF0$...
    > hello all, i am using asp.net with IIS on a Windows XP machine to open
    > an Access database, and i know that this topic has been posted on forums
    > hundreds of times, but i can't find an answer that works..
    >
    > here is the problem, i m opening the database with OleDBConnenction and
    > OleDbCommand...but i get this error:
    >
    > The Microsoft Jet database engine cannot open the file
    > 'C:\Database\database.mdb'. It is already opened exclusively by another
    > user, or you need permission to view its data.
    >
    > HOWEVER, when i put the database in D:\Database, it works just
    > fine.....i researched the forums to find an answer, i even found a topic
    > on MSDN, but that related to server based IIS, and not WIN XP, it was
    > talking about permissions to everyone, which is something not found on
    > WIN XP....the problem is that i am doing this for a college assignment,
    > and i need to hand in the database in the same folder that contains my
    > web forms and web.config and all that.....i tried to use
    > Server.MapPath("..\Database\Database.mdb"), but that also didn't
    > work....can anyone help please...
    >
    > thanks
    >
    > --
    > Sent via .NET Newsgroups
    > http://www.dotnetnewsgroups.com
    S. Justin Gengo, Dec 12, 2005
    #2
    1. Advertising

  3. semesm22

    semesm22 Guest

    thank you very very very much for that great post....i followed the
    directions, and it worked great, once again thank you

    sam

    --
    Sent via .NET Newsgroups
    http://www.dotnetnewsgroups.com
    semesm22, Dec 12, 2005
    #3
  4. semesm22

    semesm22 Guest

    i may have spoke too soon.....i was using VB.NET cause its faster to
    work with....but when i tried it with ASP.NET, i still had the same
    error message......i did the read write user permissions that you spoke
    about, for both the folder that the database is in, and the folder that
    the Solution file is in....

    any ideas

    --
    Sent via .NET Newsgroups
    http://www.dotnetnewsgroups.com
    semesm22, Dec 12, 2005
    #4
  5. Sam,

    Let's start with what permissions you're setting on the folder. Which
    account is your website running as IUSR or ASPNET?

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "semesm22" <> wrote in message
    news:utPgeE2$...
    >i may have spoke too soon.....i was using VB.NET cause its faster to
    > work with....but when i tried it with ASP.NET, i still had the same
    > error message......i did the read write user permissions that you spoke
    > about, for both the folder that the database is in, and the folder that
    > the Solution file is in....
    >
    > any ideas
    >
    > --
    > Sent via .NET Newsgroups
    > http://www.dotnetnewsgroups.com
    S. Justin Gengo, Dec 12, 2005
    #5
  6. semesm22

    semesm22 Guest

    i'm using IUSR...should i creat another...however, this is an
    assignment, so the assessor is probably using IUSR

    --
    Sent via .NET Newsgroups
    http://www.dotnetnewsgroups.com
    semesm22, Dec 12, 2005
    #6
  7. semesm22

    semesm22 Guest

    i did some research, and found out about the ASPNET user account, and i
    added that user to the .mdb file, and gave it write permission on the
    file....so i can now use an absolute path which
    "C:\Inetpub\wwwroot\Cinema\Database\database.mdb" ....
    however, when i try to use a relative path, such as
    "..\Database\database.mdb" i get an error that says

    file "'C:\WINDOWS\system32\Database\Database.mdb" not found...why is it
    looking inside C:\windows, when i m trying to just go outside the bin
    folder that contains the solution's dll file

    thanks again
    sam

    --
    Sent via .NET Newsgroups
    http://www.dotnetnewsgroups.com
    semesm22, Dec 13, 2005
    #7
  8. Sam,

    Ok, I understand the problem now. When connecting to an access database you
    have to specify the absolute path. But you can get the absolute path from
    the relative path by using Server.MapPath("[Relative Path Here]") You should
    still just need to give IUSR the permissions. Server.MapPath will return the
    absolute path of the file based on the relative path. Do a Response.Write of
    Server.MapPath to see what it is returning.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "semesm22" <> wrote in message
    news:%23hYX0p6$...
    >i did some research, and found out about the ASPNET user account, and i
    > added that user to the .mdb file, and gave it write permission on the
    > file....so i can now use an absolute path which
    > "C:\Inetpub\wwwroot\Cinema\Database\database.mdb" ....
    > however, when i try to use a relative path, such as
    > "..\Database\database.mdb" i get an error that says
    >
    > file "'C:\WINDOWS\system32\Database\Database.mdb" not found...why is it
    > looking inside C:\windows, when i m trying to just go outside the bin
    > folder that contains the solution's dll file
    >
    > thanks again
    > sam
    >
    > --
    > Sent via .NET Newsgroups
    > http://www.dotnetnewsgroups.com
    S. Justin Gengo, Dec 13, 2005
    #8
  9. semesm22

    semesm22 Guest

    semesm22, Dec 13, 2005
    #9
  10. Sam,

    You're welcome. I'm glad I was able to help!

    Happy programming,

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "semesm22" <> wrote in message
    news:...
    > thanks you very much justin, it works great now...thanks for your help
    >
    > sam
    >
    > --
    > Sent via .NET Newsgroups
    > http://www.dotnetnewsgroups.com
    S. Justin Gengo, Dec 14, 2005
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. THY
    Replies:
    4
    Views:
    499
    Gönen EREN
    Aug 22, 2003
  2. solartimba
    Replies:
    15
    Views:
    767
    red floyd
    Oct 20, 2003
  3. wax
    Replies:
    9
    Views:
    321
  4. ThunderMusic
    Replies:
    1
    Views:
    140
    ThunderMusic
    Feb 22, 2007
  5. Schüle Daniel

    File::open and File.open

    Schüle Daniel, Oct 23, 2006, in forum: Ruby
    Replies:
    4
    Views:
    178
    Rick DeNatale
    Oct 24, 2006
Loading...

Share This Page