Multiple Threads and/or Multiple Applications Accessing the Same Table RRS feed

  • Question

  • (Sorry, I'm sure it's been asked before, but my searches are coming up empty.)

    Is it safe to have multiple threads within an application or multiple applications accessing the same Access table?  I.E. will Access do the necessary locking?  Or had I better take care of the necessary locking in my threads/applications?

    Thanks,  Bob


    Monday, October 4, 2010 2:05 PM


All replies

  • will be better if you will care of locking in your application. you have more combination of locking tables and records.
    Monday, October 4, 2010 2:14 PM
  • Thank you Crash.  I know how to lock within an application, and I'm sure I can easily find out how to lock between applications running on the same system.  But what if you have applications running on more than one system and all want to update the same Access table.  How do you handle that?

    Also, I should have given some context in my first post.  I am thinking about an application, or applications, written in VB.Net which are accessing Access via an "OleDbConnection".

    Thanks,  Bob

    Monday, October 4, 2010 2:43 PM
  • when you set connection you can declare how to lock tables and record. if you use vb.net good way is using BeginTransaction and EndTransaction more information you can find here http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbconnection.aspx
    • Marked as answer by eBob.com Wednesday, October 6, 2010 1:35 AM
    Monday, October 4, 2010 2:58 PM
  • If you use VbNet, you may use ADO.Net which is a disconnected model for which there is no real need to lock 'other users' out, since you are disconnected from the database, and, on resychronisation, it is easy to see if the data in the database is still the same as when you read it. If it is NOT, someone else has modified it, and then, you need to resolve the conflict, else, no one has (or has and undone it), so you can brought your own modifications.

    It is not recommended to use a database transaction while a end user starts editing stuff... the end user may leave for lunch for one hour if not more, leaving the data locked... You should only use transactions for a very short period of time... which is not the case for data input.

    Thursday, October 7, 2010 3:29 PM