Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2006
    Posts
    7

    Unanswered: Table Locking Not Working

    Hi there,

    I am using DB2 7.1 and I am trying to lock a table in exclusive mode with the following command:

    lock table sequence_number in exclusive mode

    The command completes successfully.

    I am under the assumption that this should prevent any reads (except UR) from the sequence_number table. However I am still able to execute a select statement from another transaction with the command:

    select * FROM sequence_number with RR

    Am I missing something obvious here?


    Thank you and best wishes,

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    LOCK TABLE statement holds the lock until the next commit. If your LOCK TABLE session had autocommit, then the lock would have been released.

    Issue
    db2 +c lock table sequence_number in exclusive mode

    Issue your select statement in the other window and now it should work !!!
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Jan 2006
    Posts
    7
    Great, thanks allot - it works well now


    Best wishes,

  4. #4
    Join Date
    Apr 2004
    Posts
    54
    as well you can change autocommit dynamicly in your script:

    --disable autocommit
    update command options using c off@
    lock table mytable in exclussive mode@
    update...
    delete...
    insert...
    commit@
    -- switch to autocommit
    update command options using c on@

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •