Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Stop Access Table Locking

  1. #1
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,554
    Thanks
    24
    Thanked 304 Times in 286 Posts

    Default Stop Access Table Locking

    Is it possible to stop an instance of a program from locking another instance out of a database table?

    For example, I have a networked Access Database and program on the server that everyone can run. The problem is that if two users attempt to run the program at the same time, they conflict because one of them has locked a table. To my understanding, table locking is to protect users from getting "dirty data" when the database is being updated. That is not a concern of mine since the database will not be getting updated while the user runs the program. Instead, the program is designed purely to retrieve data, so I see no real reason for table locking. Database updating is done by a separate program and is only done every 6 months or so.

    Even some sort of queuing system will work, where the program will wait until a table is unlocked, if I have to do it that way. If so, how do I create such a thing?

    Any help is greatly appreciated. This is a significant problem we are having.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/


  2. #2
    Member DanBrown's Avatar
    Join Date
    Jan 2011
    Posts
    134
    My Mood
    Confused
    Thanks
    1
    Thanked 12 Times in 12 Posts

    Default Re: Stop Access Table Locking

    I am not much experienced as you , but i feel you can simply achieve this by connection pooling.

    If i am right then i can provide you code for that.
    Thanks and Regards
    Dan Brown

    Common Java Mistakes

  3. #3
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,104
    Thanks
    169
    Thanked 780 Times in 726 Posts
    Blog Entries
    5

    Default Re: Stop Access Table Locking

    Unless the clients are calling Lock on the tables and leaving that lock in place, you have really long transactions, or a huge number of clients always trying to pull info from the database I wouldn't expect the table locks to hugely effect clients (are you sure it is table locking that is affecting clients?). I'm not sure about the DB you are using, but for other databases I've worked with there are ways to alter the explicit table locking to allow concurrent read access, but again make sure it is table locking that is causing the problem before fiddling with the database lock parameters.

  4. #4
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,554
    Thanks
    24
    Thanked 304 Times in 286 Posts

    Default Re: Stop Access Table Locking

    It is being caused by a really long transaction. And I can confirm that the tables are locking because I explicitatly got an error message that said it could not access the table because of user x locking it. Or something along those lines. It is really hard to reproduce the error since I need to make them clash into each other. Lastly, access doesn't let you use the Connection.setTransactionIsolation(int) method.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  5. #5
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,104
    Thanks
    169
    Thanked 780 Times in 726 Posts
    Blog Entries
    5

    Default Re: Stop Access Table Locking

    This seems a bit more like an issue with the DB you are using (which I'm not familiar enough with to give advice - perhaps try their help or a db specific forum). There might be alternatives on the client side: for example loading the data more 'lazily'...only let the client load data that you need for that moment (rather than pulling it all out in one shot). This will shorten the transactions and allow multi-client access (use things like LIMIT to select just what you need). Of course this will depend upon what you need and might not be an option. Another alternative would be to move to a more flexible and lower level db system where you can more readily control these parameters (postgres, mysql, oracle - most large data db's I've seen, used, and heard of use one of these big 3 - some database admin's I know would cringe at the thought of using MSAccess as it is built more for single person use rather than multi-user or enterprise use)
    Last edited by copeg; February 4th, 2011 at 06:28 PM.

Similar Threads

  1. paying off dept ( can't make it stop at 0 )
    By bossmeister in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 16th, 2010, 07:33 AM
  2. [SOLVED] Why is my float automatically rounding and how do i get it to stop
    By Perd1t1on in forum What's Wrong With My Code?
    Replies: 18
    Last Post: August 26th, 2010, 01:41 PM
  3. radio buttons stop working
    By tabutcher in forum AWT / Java Swing
    Replies: 2
    Last Post: March 5th, 2010, 08:28 AM
  4. Default Access (package access) confusion
    By gauravrajbehl in forum Java Theory & Questions
    Replies: 1
    Last Post: November 18th, 2009, 03:11 AM
  5. Issue with JTextField Locking
    By PekinSOFT.Systems in forum AWT / Java Swing
    Replies: 0
    Last Post: October 1st, 2009, 11:12 AM