Locking records in an Oracle table with time out.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Locking records in an Oracle table with time out.

  1. #1
    Abhijeet Guest

    Locking records in an Oracle table with time out.


    How does one impliment a locking mechanism in Oracle 7.3 using VB 6 as the
    front end? In one of the modules I am developing a transaction requires to
    lock a few records of a table for updation later on, so that these records
    are not changed by other users.

    The SELECT * FROM table_name FOR UPDATE statement works, but when some other
    user attempts to update the same set of records Oracle goes into a deadlock.
    Is there any way to control a lock timeout in Oracle, which will generate
    an error when a user attempts to obtain a lock on a record that is already
    locked by some other user. This will help the application to show an error
    message to the user who fails to get the required record lock.

  2. #2
    Boris Milrud Guest

    Re: Locking records in an Oracle table with time out.


    Use FOR UPDATE clause with NOWAIT keyword: it returns control to you immediately
    with following error - ORA-00054: resource busy and acquire with NOWAIT specified.

    Boris Milrud.

    "Abhijeet" <kvabhijeet@yahoo.co.in> wrote:
    >
    >How does one impliment a locking mechanism in Oracle 7.3 using VB 6 as the
    >front end? In one of the modules I am developing a transaction requires

    to
    >lock a few records of a table for updation later on, so that these records
    >are not changed by other users.
    >
    >The SELECT * FROM table_name FOR UPDATE statement works, but when some other
    >user attempts to update the same set of records Oracle goes into a deadlock.
    >Is there any way to control a lock timeout in Oracle, which will generate
    >an error when a user attempts to obtain a lock on a record that is already
    >locked by some other user. This will help the application to show an error
    >message to the user who fails to get the required record lock.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center