devxlogo

Locking Rows

Locking Rows

Question:
We are developing an intranet application using visual interdev on windows 2000 and our informix database is on unix.

We are using stored procedures and the ‘begin work’ and ‘commit’ statements to update, insert and delete. We can lock the rows while in the stored procedure. However, we need to lock the row while the user is making changes on the intranet and not release it until the update statement has been committed.

Answer:
I don’t quite see a question here, but I’ll give you a few suggestions that may be helpful. First, try to keep the lock as short as possible. I would not initiate the lock until after the user is ready to send the changes. If that’s not possible, restrict the effect of the lock as much as possible. You may want to alter the locked row’s table to row level locking rather than the default page level locking.

The problem with locking is that it can cause concurrency problems, especially in a case where the lock is held for a very long time. What happens if you lock the rows when the user first enters the page and the user either loses his connection or decides to go to lunch, or worse yet, on vacation?

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist