Results 1 to 3 of 3

Thread: Dead Lock

  1. #1
    Join Date
    Jun 2003
    Posts
    294

    Lightbulb Unanswered: Dead Lock

    Hello !!!

    I have 2 transactions, the first one has MANY updates to the table A and it finishes with a commit or rollback (ONLY AT THE END), the second one has only one insert into the table A that finishes with a commit or rollback, the problem is that the update process takes a long time to finish, and the insert process could be thrown during the first process, there's where I get everything locked cause the table A is locked and my java aplication gets stuck.

    Note: When I execute each transaction independient I have no problems.

    Is there any possibility to lock table A completly for the first transaction and release It for second one ??

    Could you give me any suggestion of what to do step by step ?

    Thanks !!!

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Are you running these processes by submitting SQL commands from your Java App, or are you just executing existing Stored Procedures?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    begin tran
    select 1 from tableA (tablock) where 1=2
    update...
    if @@error != 0 begin
    ...
    rollback tran
    return (1)
    end
    ...
    commit tran
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

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