Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: how can I set lock timeout ?

Re: how can I set lock timeout ?

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Sun, 05 Sep 1999 16:43:01 +0800
Message-ID: <37D22D15.1197@yahoo.com>


Eunsook Jin wrote:
>
> Using oracle OCI, how can I set the lock timeout ?
> I want to rollback my transaction if it's waiting for the lock after
> specified timeout expiration.
>
> Thanks in advance.
>
> from Eunsook.

oracle doesn't have one natively...

some options:

  1. connect to the database using loopback database link so you can take advtantage of distributed lock timeout...
  2. use dbms_lock.sleep to write your own locking routine...(pseudo code below)

while true loop
begin
  ( try to get your lock in nowait fashion) exception when lock_timeout then
  if no_attempts > max_seconds then

     raise;
  else

     dbms_lock.sleep(1);
     no_of_attempts := no_of_attempts + 1
  end if;
end;
end loop;

etc - hope you get the idea

Cheers
--



Connor McDonald
"These views mine, no-one elses etc etc" connor_mcdonald_at_yahoo.com

"Some days you're the pigeon, and some days you're the statue." Received on Sun Sep 05 1999 - 03:43:01 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US