How to find out user that has a lock on a Row

How to find out user that has a lock on a Row

Postby kazachok » Wed 18 Jan 2006 13:23

Hello everyone,
I am trapping Error 1205 (innodb_lock_wait_timeout), so I would like to find out who is the user that has an Exclusive Lock for that row when this Error occurs.

Using InnoDB storage and MySQL 5.0.18, VS 2005 - C#.

I am using this strategy:
SET AUTOCOMMIT=0
START TRANSACTION
SELECT * FROM sometable WHERE id = 1 FOR UPDATE;

Code: Select all
DbCommandBase myCommand = new CoreLab.MySql.MySqlCommand("SELECT * FROM sometable WHERE id = 1 FOR UPDATE", mySQLConnection);
DbDataReader myReader = null;
IAsyncResult result = null;
try{
  result = myCommand.BeginExecuteReader(null, null, System.Data.CommandBehavior.SingleRow);
  while(!result.IsCompleted){
       /// ... Display process window
  }
   myReader = myCommand.EndExecuteReader(result);
   // ... Get the data fields
}
catch(MySqlException ex){
   switch(ex.Code){
      case 1205:
          // Here I want to find out the user that holds that lock for this record.
      break;
.....
   }
}


Any help will be appreciated.

Thanks.

Kaz
kazachok
 
Posts: 25
Joined: Fri 21 Oct 2005 12:38

Postby Serious » Thu 19 Jan 2006 16:06

There is no capabilities in MySQLDirect .NET to solve your task. We think your question relates to MySQL Server Administration. Refer to corresponding documentation.
Serious
 


Return to dotConnect for MySQL