Cannot Open Access File

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dancer

    Cannot Open Access File

    Using ASP.net 1.1 and Microsoft Access.

    I received the following error message. Why? I have closed the Access
    file. I have another very small access file that opens with no trouble with
    the same code, except a different name for the file.
    The Microsoft Jet database engine cannot open the file
    'C:\Inetpub\www root\Accident.m db'. It is already opened exclusively by
    another user, or you need permission to view its data.



  • David Wier

    #2
    Re: Cannot Open Access File

    First - have you ever been able to open it before, through the web page?
    If not - make sure the ASPNet user has 'Change' permissions on the folder
    where the Access file resides.

    --
    David Wier
    MVP/ASPInsider

    Welcome to I Write Pro — your destination for beautiful digital products designed to inspire creativity, organization, and growth. Shop printable journals, planners, coloring books, e-books, kids’ activities, and more created to help you learn, relax, and thrive.




    "dancer" <dancer@microso ft.comwrote in message
    news:O$ldXHlwHH A.424@TK2MSFTNG P06.phx.gbl...
    Using ASP.net 1.1 and Microsoft Access.
    >
    I received the following error message. Why? I have closed the Access
    file. I have another very small access file that opens with no trouble
    with the same code, except a different name for the file.
    The Microsoft Jet database engine cannot open the file
    'C:\Inetpub\www root\Accident.m db'. It is already opened exclusively by
    another user, or you need permission to view its data.
    >
    >
    >

    Comment

    • dancer

      #3
      Re: Cannot Open Access File

      How do I give 'change' permissions? And why didn't I have to give
      persmissions on my other file?


      "David Wier" <davidwier@davi dwier.nospam.co mwrote in message
      news:eAcaHOlwHH A.4544@TK2MSFTN GP05.phx.gbl...
      First - have you ever been able to open it before, through the web page?
      If not - make sure the ASPNet user has 'Change' permissions on the folder
      where the Access file resides.
      >
      --
      David Wier
      MVP/ASPInsider

      Welcome to I Write Pro — your destination for beautiful digital products designed to inspire creativity, organization, and growth. Shop printable journals, planners, coloring books, e-books, kids’ activities, and more created to help you learn, relax, and thrive.

      >
      >
      >
      "dancer" <dancer@microso ft.comwrote in message
      news:O$ldXHlwHH A.424@TK2MSFTNG P06.phx.gbl...
      >Using ASP.net 1.1 and Microsoft Access.
      >>
      >I received the following error message. Why? I have closed the Access
      >file. I have another very small access file that opens with no trouble
      >with the same code, except a different name for the file.
      >The Microsoft Jet database engine cannot open the file
      >'C:\Inetpub\ww wroot\Accident. mdb'. It is already opened exclusively by
      >another user, or you need permission to view its data.
      >>
      >>
      >>
      >
      >

      Comment

      • sloan

        #4
        Re: Cannot Open Access File

        Permissions, permissions permissions.

        ...

        access needs to create a ldb file, which basically is a internal file which
        says "userA is logged in" along with other stuff.
        but the account which asp.net runs under MUST have permissions to the mdb
        file, and to the directory to create/destroy this ldb file.



        "dancer" <dancer@microso ft.comwrote in message
        news:eQwU5TlwHH A.312@TK2MSFTNG P04.phx.gbl...
        How do I give 'change' permissions? And why didn't I have to give
        persmissions on my other file?
        >
        >
        "David Wier" <davidwier@davi dwier.nospam.co mwrote in message
        news:eAcaHOlwHH A.4544@TK2MSFTN GP05.phx.gbl...
        First - have you ever been able to open it before, through the web page?
        If not - make sure the ASPNet user has 'Change' permissions on the
        folder
        where the Access file resides.

        --
        David Wier
        MVP/ASPInsider

        Welcome to I Write Pro — your destination for beautiful digital products designed to inspire creativity, organization, and growth. Shop printable journals, planners, coloring books, e-books, kids’ activities, and more created to help you learn, relax, and thrive.




        "dancer" <dancer@microso ft.comwrote in message
        news:O$ldXHlwHH A.424@TK2MSFTNG P06.phx.gbl...
        Using ASP.net 1.1 and Microsoft Access.
        >
        I received the following error message. Why? I have closed the Access
        file. I have another very small access file that opens with no trouble
        with the same code, except a different name for the file.
        The Microsoft Jet database engine cannot open the file
        'C:\Inetpub\www root\Accident.m db'. It is already opened exclusively by
        another user, or you need permission to view its data.
        >
        >
        >
        >
        >

        Comment

        • Mark Rae [MVP]

          #5
          Re: Cannot Open Access File

          "dancer" <dancer@microso ft.comwrote in message
          news:eQwU5TlwHH A.312@TK2MSFTNG P04.phx.gbl...
          How do I give 'change' permissions?
          Right-click on the folder, click Properties, Security...
          And why didn't I have to give persmissions on my other file?
          When using Jet databases you don't just need write permissions on the .mdb
          file - you also need write permissions on the folder to allow the Jet engine
          to create the locking database (*.ldb) file...


          --
          Mark Rae
          ASP.NET MVP


          Comment

          • Mark Rae [MVP]

            #6
            Re: Cannot Open Access File

            "Juan T. Llibre" <nomailreplies@ nowhere.comwrot e in message
            news:uyTzMHmwHH A.1188@TK2MSFTN GP04.phx.gbl...
            Access97 is a bit quirky for web access.
            I'd consider upgrading the database to Access 2000 or Access 2003.
            By which, of course, you mean that Jet 3.5 is a bit quirky for web access,
            and you'd consider upgrading the database to Jet 4.0 (Access 2000, 2002 and
            2003 all use the Jet 4.0 database by default)
            Access itself isn't needed on the server. Just the database.
            Exactly - just the Jet database is needed on the server...


            --
            Mark Rae
            ASP.NET MVP


            Comment

            • dancer

              #7
              Re: Cannot Open Access File

              "When using Jet databases you don't just need write permissions on the .mdb
              file - you also need write permissions on the folder to allow the Jet
              engine to create the locking database (*.ldb) file..."
              Which folder?
              >


              "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message
              news:eRD9qblwHH A.1204@TK2MSFTN GP03.phx.gbl...
              "dancer" <dancer@microso ft.comwrote in message
              news:eQwU5TlwHH A.312@TK2MSFTNG P04.phx.gbl...
              >
              >How do I give 'change' permissions?
              >
              Right-click on the folder, click Properties, Security...
              >
              >And why didn't I have to give persmissions on my other file?
              >
              When using Jet databases you don't just need write permissions on the .mdb
              file - you also need write permissions on the folder to allow the Jet
              engine to create the locking database (*.ldb) file...
              >
              >
              --
              Mark Rae
              ASP.NET MVP
              http://www.markrae.net

              Comment

              • dancer

                #8
                Re: Cannot Open Access File

                I am using Access 2003. I know not what Jet version. I am testing on
                local host.
                I created another Access file, copied the data, saved it, and it opened just
                fine!!! But it probably will happen again.

                Now another problem: when I downloaded to my host server and tried to run it
                I got the following message.
                When I downloaded it, I got the message, "Do you want to change the database
                connection?" The first time I said no, the next time I said yes, but
                still got the same error message on trying to run it. Any help will be
                appreciated.

                Could not find file 'c:\windows\sys tem32\inetsrv\A cc.mdb'.
                Description: An unhandled exception occurred during the execution of the
                current web request. Please review the stack trace for more information
                about the error and where it originated in the code.

                Exception Details: System.Data.Ole Db.OleDbExcepti on: Could not find file
                'c:\windows\sys tem32\inetsrv\A cc.mdb'.

                Source Error:

                Line 7: DBConnection = New
                OledbConnection ("Provider=Micr osoft.Jet.Oledb .4.0;" & _
                Line 8: "Data Source=Acc.mdb" )
                Line 9: DBConnection.Op en()
                Line 10:
                Line 11: Dim DBCommand As OledbCommand

                Source File: e:\accounts\whe e13\WWW\databas e_acc_host.aspx Line: 9

                Stack Trace:

                [OleDbException (0x80004005): Could not find file
                'c:\windows\sys tem32\inetsrv\A cc.mdb'.]
                System.Data.Ole Db.OleDbConnect ion.ProcessResu lts(Int32 hr) +20
                System.Data.Ole Db.OleDbConnect ion.InitializeP rovider() +57
                System.Data.Ole Db.OleDbConnect ion.Open() +203
                ASP.database_Ac c_host_aspx.Pag e_Load(Object sender, EventArgs e) in
                e:\accounts\whe e13\WWW\databas e_acc_host.aspx :9
                System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
                System.Web.UI.C ontrol.LoadRecu rsive() +35
                System.Web.UI.P age.ProcessRequ estMain() +750





                "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message
                news:uKkx%23Qmw HHA.4332@TK2MSF TNGP06.phx.gbl. ..
                "Juan T. Llibre" <nomailreplies@ nowhere.comwrot e in message
                news:uyTzMHmwHH A.1188@TK2MSFTN GP04.phx.gbl...
                >
                >Access97 is a bit quirky for web access.
                >I'd consider upgrading the database to Access 2000 or Access 2003.
                >
                By which, of course, you mean that Jet 3.5 is a bit quirky for web access,
                and you'd consider upgrading the database to Jet 4.0 (Access 2000, 2002
                and 2003 all use the Jet 4.0 database by default)
                >
                >Access itself isn't needed on the server. Just the database.
                >
                Exactly - just the Jet database is needed on the server...
                >
                >
                --
                Mark Rae
                ASP.NET MVP
                http://www.markrae.net

                Comment

                • Mark Rae [MVP]

                  #9
                  Re: Cannot Open Access File

                  "dancer" <dancer@microso ft.comwrote in message
                  news:uO6ghuvwHH A.4572@TK2MSFTN GP02.phx.gbl...
                  I am using Access 2003.
                  Have you actually installed a copy of Microsoft Access on your webserver?
                  Yes or no?
                  I created another Access file,
                  No you didn't! You created another Jet database! I know you *think* you're
                  using Microsoft Access, but you really aren't...
                  DBConnection = New OledbConnection ("Provider=Micr osoft.Jet.Oledb .4.0;"
                  See, there's the thing right there. Look at the Provider part of your
                  connection string - it's using Jet 4...


                  --
                  Mark Rae
                  ASP.NET MVP


                  Comment

                  • Mark Rae [MVP]

                    #10
                    Re: Cannot Open Access File

                    "dancer" <dancer@microso ft.comwrote in message
                    news:uwn4EPvwHH A.3684@TK2MSFTN GP02.phx.gbl...
                    "When using Jet databases you don't just need write permissions on the
                    .mdb
                    >file - you also need write permissions on the folder to allow the Jet
                    >engine to create the locking database (*.ldb) file..."
                    >
                    Which folder?
                    The folder that your Jet database is in...


                    --
                    Mark Rae
                    ASP.NET MVP


                    Comment

                    • Mark Rae [MVP]

                      #11
                      Re: Cannot Open Access File

                      "dancer" <dancer@microso ft.comwrote in message news:%2377Q0uyw HHA.3400@TK2MSF TNGP03.phx.gbl. ..
                      I did NOT install Microsoft Access.
                      That's good.
                      The reason I went to my host server TO install it is because YOU asked,
                      "Have you actually installed a copy of Microsoft Access on your webserver? Yes or no?"
                      when I mentioned the error, "Could not find file 'c:\windows\sys tem32\inetsrv\A cc.mdb'"
                      Do you remember that?
                      Yes I do.
                      Why did you ask me that?
                      Because I wanted to make certain that you *hadn't* installed Microsoft Access on your webserver... :-)
                      What is your reason as to why I get the above error when trying to run my
                      file at my host server? Why is it looking for the file on my computer? I
                      downloaded the acc.mdb file to the host. Nowhere in my code do I refer to
                      "c:\windows , etc."
                      Because it can't find the Jet database, so it's looking in the folder it's currently running from instead...
                      DBConnection = New OledbConnection ("Provider=Micr osoft.Jet.Oledb .4.0;Data Source=Acc.mdb"
                      Where *precisely* on your webserver is the Acc.mdb Jet database? Is it in your web app's virtual directory, maybe in the App_Data subfolder...?


                      --
                      Mark Rae
                      ASP.NET MVP

                      Comment

                      • Juan T. Llibre

                        #12
                        Re: Cannot Open Access File

                        re:
                        !DBConnection = New OledbConnection ("Provider=Micr osoft.Jet.Oledb .4.0;Data Source=Acc.mdb"

                        That connection assumes the mdb file is located in the c:\windows\syst em32\inetsrv directory.

                        An OledbConnection expects a complete physical directory path,
                        if the path is ,ocated outside the website's directory path :

                        c:\somepath\som eother dir\Acc.mdb

                        or... a virtual path which can be translated by Server.MapPath.

                        DBConnection = New OledbConnection ("Provider=Micr osoft.Jet.Oledb .4.0;Data Source=" & Server.Mappath "/App_Data/Acc.mdb")

                        Btw, Acc.mdb should *never* be placed anywhere but in the App_Data directory.
                        As long as the mdb is in the App_Data dir, it cannot be downloaded via a direct link.

                        Placing it in the root directory of your app allows hackers to download your database.




                        Juan T. Llibre, asp.net MVP
                        asp.net faq : http://asp.net.do/faq/
                        foros de asp.net, en español : http://asp.net.do/foros/
                        =============== =============== ========
                        "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message news:eVUGl6ywHH A.1208@TK2MSFTN GP03.phx.gbl...
                        "dancer" <dancer@microso ft.comwrote in message news:%2377Q0uyw HHA.3400@TK2MSF TNGP03.phx.gbl. ..
                        I did NOT install Microsoft Access.
                        That's good.
                        The reason I went to my host server TO install it is because YOU asked,
                        "Have you actually installed a copy of Microsoft Access on your webserver? Yes or no?"
                        when I mentioned the error, "Could not find file 'c:\windows\sys tem32\inetsrv\A cc.mdb'"
                        Do you remember that?
                        Yes I do.
                        Why did you ask me that?
                        Because I wanted to make certain that you *hadn't* installed Microsoft Access on your webserver... :-)
                        What is your reason as to why I get the above error when trying to run my
                        file at my host server? Why is it looking for the file on my computer? I
                        downloaded the acc.mdb file to the host. Nowhere in my code do I refer to
                        "c:\windows , etc."
                        Because it can't find the Jet database, so it's looking in the folder it's currently running from instead...
                        DBConnection = New OledbConnection ("Provider=Micr osoft.Jet.Oledb .4.0;Data Source=Acc.mdb"
                        Where *precisely* on your webserver is the Acc.mdb Jet database? Is it in your web app's virtual directory, maybe in the
                        App_Data subfolder...?


                        --
                        Mark Rae
                        ASP.NET MVP



                        Comment

                        • dancer

                          #13
                          Re: Cannot Open Access File

                          Where *precisely* on your webserver is the Acc.mdb Jet database? Is it in your web app's virtual directory, maybe in the App_Data subfolder...?

                          I tried it in the same place as my aspx file (the root)
                          I also tried it in the database folder.


                          "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message news:eVUGl6ywHH A.1208@TK2MSFTN GP03.phx.gbl...
                          "dancer" <dancer@microso ft.comwrote in message news:%2377Q0uyw HHA.3400@TK2MSF TNGP03.phx.gbl. ..
                          I did NOT install Microsoft Access.
                          That's good.
                          The reason I went to my host server TO install it is because YOU asked,
                          "Have you actually installed a copy of Microsoft Access on your webserver? Yes or no?"
                          when I mentioned the error, "Could not find file 'c:\windows\sys tem32\inetsrv\A cc.mdb'"
                          Do you remember that?
                          Yes I do.
                          Why did you ask me that?
                          Because I wanted to make certain that you *hadn't* installed Microsoft Access on your webserver... :-)
                          What is your reason as to why I get the above error when trying to run my
                          file at my host server? Why is it looking for the file on my computer? I
                          downloaded the acc.mdb file to the host. Nowhere in my code do I refer to
                          "c:\windows , etc."
                          Because it can't find the Jet database, so it's looking in the folder it's currently running from instead...
                          DBConnection = New OledbConnection ("Provider=Micr osoft.Jet.Oledb .4.0;Data Source=Acc.mdb"
                          Where *precisely* on your webserver is the Acc.mdb Jet database? Is it in your web app's virtual directory, maybe in the App_Data subfolder...?


                          --
                          Mark Rae
                          ASP.NET MVP

                          Comment

                          • Mark Rae [MVP]

                            #14
                            Re: Cannot Open Access File

                            "Juan T. Llibre" <nomailreplies@ nowhere.comwrot e in message
                            news:O%23m1DEzw HHA.3684@TK2MSF TNGP02.phx.gbl. ..
                            !DBConnection = New
                            OledbConnection ("Provider=Micr osoft.Jet.Oledb .4.0;Data Source=Acc.mdb"
                            >
                            That connection assumes the mdb file is located in the
                            c:\windows\syst em32\inetsrv directory.
                            Indeed.
                            An OledbConnection expects a complete physical directory path,
                            if the path is ,ocated outside the website's directory path :
                            Quite so.
                            Btw, Acc.mdb should *never* be placed anywhere but in the App_Data
                            directory.
                            As long as the mdb is in the App_Data dir, it cannot be downloaded via a
                            direct link.
                            Definitely.


                            --
                            Mark Rae
                            ASP.NET MVP


                            Comment

                            • Juan T. Llibre

                              #15
                              Re: Cannot Open Access File

                              See my just-sent reply to this thread.

                              It has the info you need to solve your problem.




                              Juan T. Llibre, asp.net MVP
                              asp.net faq : http://asp.net.do/faq/
                              foros de asp.net, en español : http://asp.net.do/foros/
                              =============== =============== ========
                              "dancer" <dancer@microso ft.comwrote in message news:uXbdmNzwHH A.1484@TK2MSFTN GP06.phx.gbl...
                              Where *precisely* on your webserver is the Acc.mdb Jet database? Is it in your web app's virtual directory, maybe in the
                              App_Data subfolder...?

                              I tried it in the same place as my aspx file (the root)
                              I also tried it in the database folder.


                              "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message news:eVUGl6ywHH A.1208@TK2MSFTN GP03.phx.gbl...
                              "dancer" <dancer@microso ft.comwrote in message news:%2377Q0uyw HHA.3400@TK2MSF TNGP03.phx.gbl. ..
                              I did NOT install Microsoft Access.
                              That's good.
                              The reason I went to my host server TO install it is because YOU asked,
                              "Have you actually installed a copy of Microsoft Access on your webserver? Yes or no?"
                              when I mentioned the error, "Could not find file 'c:\windows\sys tem32\inetsrv\A cc.mdb'"
                              Do you remember that?
                              Yes I do.
                              Why did you ask me that?
                              Because I wanted to make certain that you *hadn't* installed Microsoft Access on your webserver... :-)
                              What is your reason as to why I get the above error when trying to run my
                              file at my host server? Why is it looking for the file on my computer? I
                              downloaded the acc.mdb file to the host. Nowhere in my code do I refer to
                              "c:\windows , etc."
                              Because it can't find the Jet database, so it's looking in the folder it's currently running from instead...
                              DBConnection = New OledbConnection ("Provider=Micr osoft.Jet.Oledb .4.0;Data Source=Acc.mdb"
                              Where *precisely* on your webserver is the Acc.mdb Jet database? Is it in your web app's virtual directory, maybe in
                              the App_Data subfolder...?


                              --
                              Mark Rae
                              ASP.NET MVP



                              Comment

                              Working...