• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

exclusive row level lock in MySql

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how to create exlusive row level lock in mySQL database (db version 4.0 and database type is InnoDB). Please explain me thru' sql syntax.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well in oracle, you would enter something like

sql> Select <columns> from <table> where <condition> FOR UPDATE;

This puts a Exclusive lock on the selected rows that will be release by either a commit / rollback;

If you fail to provide a where condition then the entire table is locked.
 
muthu muruges
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what about in MySQL?,

I would like the locking query should work for the following scenario,
1) Having one DB connection
2) lock some rows by one thread
3) using the same connection lock some other rows by the second thread
4) release the lock aquired by the first thread, during this lock relase the second lock should not get relased
5) release the lock aquired by the second thread

is there any row level readlock or writelock exist in MySQL?
 
muthu muruges
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any updates please.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Muthu,
According to the documentation, you get table level locking by default.
 
reply
    Bookmark Topic Watch Topic
  • New Topic