Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2003
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up transaction deadlock when using "autocommit"

    In PHP:

    Transaction is a big problem in MySQL --> here is what I have done
    Since the DB is InnoDB, I tried to "set autocommit=0" so that it can be rollback if it wants, and data will not be actually updated into the file disk unless a "commit" is performed.

    I typed:

    $autocommit = "SET autocommit=0";
    $setcommit = mysql_query($autocommit);
    echo "<font color = yellow> Setcommit = $setcommit </font><BR>";

    and then it worked once, but then for the second time, when I go to mySQL and try to do something, it came an error of :

    ERROR 1205: Lock wait timeout exceeded; Try restarting transaction

    which is probably the deadlock problem...I have to release the lock by
    i) show processlist; (and see which thread is sleeping)
    ii) kill thread_id;

    Does anyone know how to perform transaction with php using InnoDB?

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Read our forum rules. Don't crosspost!!!
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

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