Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Write and read lock

Former Member
0 Likes
1,459

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,057

Hi,

I guess for reading, lock is not required.

Regards

Radhika

8 REPLIES 8
Read only

Former Member
0 Likes
1,058

Hi,

I guess for reading, lock is not required.

Regards

Radhika

Read only

former_member404244
Active Contributor
0 Likes
1,057

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

Read only

0 Likes
1,057

HI nagaraj,

Do you mean to use just write lock ?

Can you explain little bit more why ?

Regards

Chris

Read only

0 Likes
1,057

Hi chris,

I would suggest to have a search in SCN reagrding the same and you will get lot of information....

Regards,

Nagaraj

Read only

0 Likes
1,057

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.

Read only

0 Likes
1,057

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

Read only

Former Member
0 Likes
1,057

Hi,

Not needed. There is no such concept for read. The only reason behind ( Write lock ) this is to maintain data integrity.

Regards

Abhii

Read only

Former Member
0 Likes
1,057

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.