Home > database >  MySql temporary table concurrency issues
MySql temporary table concurrency issues

Time:12-11

Online say MySql temporary table with connecting binding, tested in some cases there will be a concurrency issues
 
Using (MySqlConnection con=new MySqlConnection (sqlConn))
{
Con. The Open ();
MySqlCommand CMD=new MySqlCommand (" CREATE TEMPORARY TABLE TTTT (select 1 a);" , con);
CMD. ExecuteNonQuery ();

Con. The Close ();
}

In the same program, the second run will prompt error,

But double open the program, in A program for the first time after the operation, the first run without B program has problems, but the second run A program or B procedure will prompt wrong,

CodePudding user response:

A temporary table is in this connection, the scope of the life cycle and disconnects shall be released, so A connection of A temporary table can only be used in A connection, cannot be used in the connection B,
  • Related