‎2009 Nov 30 9:26 AM
HI ,
I use the write lock in order to update user records in DB (for every update record user ) my question is when i read user records do i need to create new read lock or use the same lock (write )
Regards
Chris
‎2009 Nov 30 9:30 AM
‎2009 Nov 30 9:30 AM
‎2009 Nov 30 9:31 AM
Hi Chris,
Whenever you update anything to database table at that time only lock the table for other uses no need for any lock.
Regards,
Nagaraj
‎2009 Nov 30 9:37 AM
HI nagaraj,
Do you mean to use just write lock ?
Can you explain little bit more why ?
Regards
Chris
‎2009 Nov 30 9:52 AM
Hi chris,
I would suggest to have a search in SCN reagrding the same and you will get lot of information....
Regards,
Nagaraj
‎2009 Nov 30 10:05 AM
Hi Chris,
Reading of database table do not require lock.During write we use lock to maintain data integrity and consistency.
SAP Provide three type of Lock objects.
1. Read Lock(Shared Locked)
2. Write Lock(exclusive lock)
3. Enhanced write lock (exclusive lock without cumulating)
you can search for these on SDN.
‎2009 Nov 30 11:35 AM
Hi Chris,
you will not require any lock for reading purpose this is because many users can read the particular data (as no updation is required) read lock is also known as Shared lock.
In case if you want to write or update the database then Write lock is required so that no other user can write when you are writting on the database, write locks are also known as Exclusive locks.
if you dont put the lock before writing then it may happen that 2 users write at same time which will lead to the situation of Dirty Read or Dirty Write.
One thing more if one user have locked some object for writing then that user needs to unlock that object then only other user can lock it and write on that object other wise other user have to wait till the first user unlock the object.
it can be the case that user A have locked item 1 and he wanted to write on item 2 but item 2 have been locked by user B and user B wants to write on item 1 so both the users are waiting to write and they are not unlocking the objects.This caase is known as DEADLOCK.
Hope this will help you.
Thanks
Tanmaya Gupta
‎2009 Nov 30 9:31 AM
Hi,
Not needed. There is no such concept for read. The only reason behind ( Write lock ) this is to maintain data integrity.
Regards
Abhii
‎2009 Nov 30 9:32 AM
Hi,
I haven't worked extensively on Locking Objects in ABAP.
But I do have some idea on RDBMS Locking Concepts.
When you have locked some table for Write, few databases dont allow a read lock on them.
Few others do allow a read lock, but you get to read the last consistent state of those table or records in the database.
@Others
Please do correct me if I am wrong.