• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

database locking

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,

I have 3 clients which is updating my database,these three cleints is changing the data in the database at the same time.i want to to solve make the updation one by one with out using the thread mechanism(like synchronization ).

can anyone help me to solve this issue
 
author
Posts: 4342
40
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not manage the information using an in-memory cache, which periodically dumps to the database? If you really want all 3 to have simultaneous access, database ACID principles are probably going to cause some users to get stale data exceptions. Alternatively, you could catch stale data exceptions and transparently refresh the user's data.
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It depends on the system in question, but generally speaking there are two way to go: an optimistic locking strategy or a pessimistic locking strategy.
You'll need to determine if collisions are expected to occur frequently in your multi-user system and what's an acceptable way of dealing with them when they do. The first strategy seems like the most obvious candidate for a foolproof solution, but a pessimistic approach risks compromising the performance of the system as a whole, which is something to be wary of.
 
He's giving us the slip! Quick! Grab this tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic