#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Select ..... for update problem!!!!


    SELECT .... FOR UPDATE not working when fired from remote accounts. It works fine when i run it from the command line client directly on the server using root@localhost account. I have given all privileges to my remote accounts and it doesnt work. I am using DBFORGE studio as client. When i execute the following statement

    SELECT * FROM SOMETABLE WHERE ID = 8 FOR UPDATE;

    it runs and finishes and everything looks fine. Then i log to my server, run command line and connect to my MySql db as root@localhost to test. Aggain i run

    SELECT * FROM SOMETABLE WHERE ID = 8 FOR UPDATE;

    And it finishes. So row wasnt locked!?!?!?. I'm like WTF? So i go back to dbForge studio running on my computer and run

    SELECT * FROM SOMETABLE WHERE ID = 8 FOR UPDATE;

    AND ROW IS LOCKED, TRANSACTION IS WAITING!!!

    I cannot figure out why SELECT .... FOR UPDATE doesnt lock the row when run by remote accounts from remote computer, and workse when run from the server.

    PLEASE HELP!!!!

    BTW. I HAVE TRIED EVERYTHING. GIVEN THE USERS GRANT ALL PRIVILEGES and everything!!!
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0
    class Program
    {
    private static string ConnectionString
    {
    get
    {
    return "server=myIp;User Id=myUser;database=myDatabase;password=myPassword";
    }
    }

    static void Main(string[] args)
    {
    DataRow row = MySqlHelper.ExecuteDataRow(ConnectionString, "select * from korisnik where id = 8 for update");

    DataRow row2 = MySqlHelper.ExecuteDataRow(ConnectionString, "select * from information_schema.innodb_locks");
    }
    }


    So i have created little test program. And row2 is NULL? Locking row just doesnt work from any user other then root@localhost.

    Please help!

IMN logo majestic logo threadwatch logo seochat tools logo