Access multiuser / transactions / asp

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Access multiuser / transactions / asp

    Hi all

    I'm getting this error message :
    The table "MyTable" is already opened exclusively by another user or it is
    already open throught the user interface and cannot be manipulated
    programmatically
    Of course Access User interface is not opened.

    This happens when 2 users try to write to the same table simultaneously.
    Everything runs fine when the users do not perform the same action at the
    very same time, I mean do not try to write to the same table at the very
    same time.

    Users use an ASP front end.
    My connection string :
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and
    Settings\xxx\MyDatabase.mdb;User ID=admin;"

    My Database properties :
    Default Opening Mode = Shared
    Default Lock = No Lock

    My ASP Code :
    Conn.Open
    Conn.BeginTrans
    Conn.execute "DELETE * FROM MyTable"
    Conn.execute "INSERT INTO MyTable ..."
    rs.Open "SELECT * FROM MyTable"
    response.write(rs.fields(xxx))
    rs.close
    Conn.Committrans

    Is the exclusive lock caused by the transaction ?
    If yes, is there a way to make the second user wait ?
    If no, is there a solution to solve this problem ?

    My general purpose is to use the same table to store some user specific
    temporary information and immediately display it.
    So 2 users should not write to that table at the same time because i don't
    have a userID field.
    That's why i use transactions, but maybe this design is not very good.
    If i need to create a userID field, i don't know what value i could write :
    maybe some session ID ?

    Thanks to those who will reach the end of my question(s).
    Any advice welcome.

    Bye


    Patrick Guest

  2. Similar Questions and Discussions

    1. Access + Asp + multiuser + table lock
      Hi all. In my asp site, i have a "Search and Sort" button that creates a lot of activity in my access database. Clciking on the button does...
    2. Transactions in Access
      Just a quickie, is it possible to do transactions in Access, in that for example I can execute 3 different update or insert statements and if one of...
    3. Xtra MultiUser
      I mean to the MultiUser Xtra.. Thanks.. "Ned" <nednet_HATES_SPAM@wanadoo.fr> escribió en el mensaje news:bo939e$jfm$1@forums.macromedia.com......
    4. Multiuser
      I need any plugin to mount a program multiuser? Jota
    5. Going from multiuser to single-user back to multiuser
      Yesterday I had occasion to bring our 5.0.7 system down to single-user mode using shutdown -g0 su . When done with my maintenance, I exited...
  3. #2

    Default Re: Access multiuser / transactions / asp

    Patrick wrote:
    > Hi all
    >
    > I'm getting this error message :
    > The table "MyTable" is already opened exclusively by another user or
    > it is already open throught the user interface and cannot be
    > manipulated programmatically
    Your answer will be in here:
    [url]http://www.aspfaq.com/show.asp?id=2009[/url]

    Bob Barrows

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

  4. #3

    Default Re: Access multiuser / transactions / asp

    If you have the data to insert into the table, and you are just going to
    retrieve it immediately after you insert it, then why are you inserting it
    into the database? Will another page be using it? If so, you need an id to
    prevent another user from deleting the data before the first user is done
    with it.

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    [url]www.ielearning.com[/url]


    "Patrick" <xxx@xxx.xxx> wrote in message
    news:eJIEamLHEHA.2720@TK2MSFTNGP11.phx.gbl...
    > Hi all
    >
    > I'm getting this error message :
    > The table "MyTable" is already opened exclusively by another user or it is
    > already open throught the user interface and cannot be manipulated
    > programmatically
    > Of course Access User interface is not opened.
    >
    > This happens when 2 users try to write to the same table simultaneously.
    > Everything runs fine when the users do not perform the same action at the
    > very same time, I mean do not try to write to the same table at the very
    > same time.
    >
    > Users use an ASP front end.
    > My connection string :
    > "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and
    > Settings\xxx\MyDatabase.mdb;User ID=admin;"
    >
    > My Database properties :
    > Default Opening Mode = Shared
    > Default Lock = No Lock
    >
    > My ASP Code :
    > Conn.Open
    > Conn.BeginTrans
    > Conn.execute "DELETE * FROM MyTable"
    > Conn.execute "INSERT INTO MyTable ..."
    > rs.Open "SELECT * FROM MyTable"
    > response.write(rs.fields(xxx))
    > rs.close
    > Conn.Committrans
    >
    > Is the exclusive lock caused by the transaction ?
    > If yes, is there a way to make the second user wait ?
    > If no, is there a solution to solve this problem ?
    >
    > My general purpose is to use the same table to store some user specific
    > temporary information and immediately display it.
    > So 2 users should not write to that table at the same time because i don't
    > have a userID field.
    > That's why i use transactions, but maybe this design is not very good.
    > If i need to create a userID field, i don't know what value i could write
    :
    > maybe some session ID ?
    >
    > Thanks to those who will reach the end of my question(s).
    > Any advice welcome.
    >
    > Bye
    >
    >

    Mark Schupp Guest

  5. #4

    Default Re: Access multiuser / transactions / asp

    Thanks for your answer Bob, but i can't find my error message in the page
    you mention.

    I have no problem accessing the database file : it is not a file error, but
    a table error.
    What can cause this exclusive lock on the table (and not on the file) ?
    Is it the transaction ?


    "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> a écrit dans le message de
    news:%23OI8GUMHEHA.2128@TK2MSFTNGP11.phx.gbl...
    > Patrick wrote:
    > > Hi all
    > >
    > > I'm getting this error message :
    > > The table "MyTable" is already opened exclusively by another user or
    > > it is already open throught the user interface and cannot be
    > > manipulated programmatically
    >
    > Your answer will be in here:
    > [url]http://www.aspfaq.com/show.asp?id=2009[/url]
    >
    > Bob Barrows
    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >

    Patrick Guest

  6. #5

    Default Re: Access multiuser / transactions / asp

    My operations on the table are much more complicated than the example i give
    and involves other tables.
    That is why is use a table : to use relations to other tables and
    referential integrity.

    I think a good ID could be the SessionID. Do you agree ?

    "Mark Schupp" <mschupp@ielearning.com> a écrit dans le message de
    news:OvT4vtMHEHA.700@TK2MSFTNGP09.phx.gbl...
    > If you have the data to insert into the table, and you are just going to
    > retrieve it immediately after you insert it, then why are you inserting it
    > into the database? Will another page be using it? If so, you need an id to
    > prevent another user from deleting the data before the first user is done
    > with it.
    >
    > --
    > Mark Schupp
    > Head of Development
    > Integrity eLearning
    > [url]www.ielearning.com[/url]

    Patrick Guest

  7. #6

    Default Re: Access multiuser / transactions / asp

    You should always give examples that accurately reflect what you are trying
    to do.

    Session ID will be fine if the data is temporary and only one web-server
    will be accessing the database (session ids are not unique across servers
    and may be repeated if IIS restarts).

    If you still need to use a transaction, close it as soon as all data updates
    have occurred.

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    [url]www.ielearning.com[/url]


    "Patrick" <xxx@xxx.xxx> wrote in message
    news:ePhpsUXHEHA.164@tk2msftngp13.phx.gbl...
    > My operations on the table are much more complicated than the example i
    give
    > and involves other tables.
    > That is why is use a table : to use relations to other tables and
    > referential integrity.
    >
    > I think a good ID could be the SessionID. Do you agree ?
    >
    > "Mark Schupp" <mschupp@ielearning.com> a écrit dans le message de
    > news:OvT4vtMHEHA.700@TK2MSFTNGP09.phx.gbl...
    > > If you have the data to insert into the table, and you are just going to
    > > retrieve it immediately after you insert it, then why are you inserting
    it
    > > into the database? Will another page be using it? If so, you need an id
    to
    > > prevent another user from deleting the data before the first user is
    done
    > > with it.
    > >
    > > --
    > > Mark Schupp
    > > Head of Development
    > > Integrity eLearning
    > > [url]www.ielearning.com[/url]
    >
    >

    Mark Schupp Guest

  8. #7

    Default Re: Access multiuser / transactions / asp

    Thanks for your help Mark

    "Mark Schupp" <mschupp@ielearning.com> a écrit dans le message de
    news:OygvR3XHEHA.828@TK2MSFTNGP12.phx.gbl...
    > You should always give examples that accurately reflect what you are
    trying
    > to do.
    >
    > Session ID will be fine if the data is temporary and only one web-server
    > will be accessing the database (session ids are not unique across servers
    > and may be repeated if IIS restarts).
    >
    > If you still need to use a transaction, close it as soon as all data
    updates
    > have occurred.
    >
    > --
    > Mark Schupp
    > Head of Development
    > Integrity eLearning
    > [url]www.ielearning.com[/url]

    Patrick Guest

  9. #8

    Default Re: Access multiuser / transactions / asp

    Patrick wrote:
    > Thanks for your answer Bob, but i can't find my error message in the
    > page you mention.
    Really? It's very similar to te first error listed.
    >
    > I have no problem accessing the database file : it is not a file
    > error, but a table error.
    I disagree. it is a folder permissions problem. The IUSR account needs
    Change permissions for the folder containing your database. Please verify
    that this is the case. If it is, then we need to look for other causes of
    your problem.

    Bob Barrows

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

  10. #9

    Default Re: Access multiuser / transactions / asp

    i gave the IUSR account all the rights to the folder.
    i did too with my administrator account as my asp pages are not allowed to
    anonymous users.
    All of these didn't solve the problem.

    I have absolutely no problem accessing the database file : my app works fine
    with one user or multiple users.

    I have trouble when two users try to write/update/delete in the same table
    at the same time.
    These actions are nested in a transaction because i wanted to create a kind
    of queue : the second users wait until first user's transaction is finished.
    It used to work before.
    I don't know why it doesn't work anymore : i made too much changes to
    remember.

    What causes the exclusive lock on the table ? Is it the transaction ?
    If yes, why doesn't the second user wait ?

    I'm lost...



    "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> a écrit dans le message de
    news:%23UT3tHZHEHA.520@tk2msftngp13.phx.gbl...
    > Patrick wrote:
    > > Thanks for your answer Bob, but i can't find my error message in the
    > > page you mention.
    >
    > Really? It's very similar to te first error listed.
    > >
    > > I have no problem accessing the database file : it is not a file
    > > error, but a table error.
    >
    > I disagree. it is a folder permissions problem. The IUSR account needs
    > Change permissions for the folder containing your database. Please verify
    > that this is the case. If it is, then we need to look for other causes of
    > your problem.
    >
    > Bob Barrows
    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >

    Patrick Guest

  11. #10

    Default Re: Access multiuser / transactions / asp

    Patrick wrote:
    > i gave the IUSR account all the rights to the folder.
    > i did too with my administrator account as my asp pages are not
    > allowed to anonymous users.
    > All of these didn't solve the problem.
    >
    > I have absolutely no problem accessing the database file : my app
    > works fine with one user or multiple users.
    >
    > I have trouble when two users try to write/update/delete in the same
    > table at the same time.
    > These actions are nested in a transaction because i wanted to create
    > a kind of queue : the second users wait until first user's
    > transaction is finished. It used to work before.
    > I don't know why it doesn't work anymore : i made too much changes to
    > remember.
    Are you using error-handling to allow the second user's transaction to wait
    until the first user's transaction is completed?
    >
    > What causes the exclusive lock on the table ? Is it the transaction ?
    > If yes, why doesn't the second user wait ?
    >
    Access (Jet) does not do row-level locking. It locks data by page, each page
    being 2 kb. So it is a possibility that the row the second user is trying to
    edit is in the page of data that is locked by the first user. It is also
    possible that the changes being done by the first user requires the lock to
    be escalated to the table level. This could be as a result of modifying an
    indexed field or some other action that requires an index to be rebuilt.

    This is the reason that it is best to keep transactions as short as
    possible. I suspect that you are going to need to migrate to a real database
    server if you are going to need this kind of transaction control.

    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

  12. #11

    Default Re: Access multiuser / transactions / asp

    > Are you using error-handling to allow the second user's transaction to
    wait
    > until the first user's transaction is completed?
    No,
    I thought it was a default behavior with transactions.
    It worked before, but maybe for an other reason.
    Check this :
    [url]http://www.mail-archive.com/bdotnet@groups.msn.com/msg11234.html[/url]
    It explains what i call the "queue" : "the other
    persons ReadRequest continuously Pings the DB until the FirstPerson
    Commits/Rollback
    his Changes "
    > Access (Jet) does not do row-level locking. It locks data by page, each
    page
    > being 2 kb. So it is a possibility that the row the second user is trying
    to
    > edit is in the page of data that is locked by the first user. It is also
    > possible that the changes being done by the first user requires the lock
    to
    > be escalated to the table level. This could be as a result of modifying an
    > indexed field or some other action that requires an index to be rebuilt.
    >
    > This is the reason that it is best to keep transactions as short as
    > possible. I suspect that you are going to need to migrate to a real
    database
    > server if you are going to need this kind of transaction control.


    Patrick Guest

  13. #12

    Default Re: Access multiuser / transactions / asp

    Patrick wrote:
    >> Are you using error-handling to allow the second user's transaction
    >> to wait until the first user's transaction is completed?
    >
    > No,
    Well, I think you are going to have to handle this error, don't you?
    > I thought it was a default behavior with transactions.
    > It worked before, but maybe for an other reason.
    > Check this :
    > [url]http://www.mail-archive.com/bdotnet@groups.msn.com/msg11234.html[/url]
    dotnet? This is a .Net question? This is a classic ASP newsgroup. You should
    be asking this question in one of the dotnet newsgroups. ADO.Net is
    different from classic ADO. Try
    microsoft.public.dotnet.framework.adonet

    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

  14. #13

    Default Re: Access multiuser / transactions / asp

    Oh wait. As Emily Litella used to say: Never mind!

    I just looked at the code in your first message and it is not .Net code. The
    "dotnet" was simply the name of the website ...

    Sorry.
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

  15. #14

    Default Re: Access multiuser / transactions / asp

    Bob, let me thank you for all your answers.

    It's time to close this topic because now i understand that i want something
    that doesn't exist.

    I'll solve this problem with 2 modifications :

    1. when possible, use a field to recover User ID and thus having the same
    table contain rows for many users instead of one. That will prevent 2 users
    to need the same row.

    2. when not possible, error handling to make the user wait



    See you !



    "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> a écrit dans le message de
    news:edyi0zaHEHA.3364@TK2MSFTNGP09.phx.gbl...
    > Oh wait. As Emily Litella used to say: Never mind!
    >
    > I just looked at the code in your first message and it is not .Net code.
    The
    > "dotnet" was simply the name of the website ...
    >
    > Sorry.
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >

    Patrick Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139