dotConnect for MySQL Documentation
Devart.Data.MySql Namespace / MySqlConnectionStringBuilder Class / ClientInteractive Property
Example

In This Topic
    ClientInteractive Property
    In This Topic
    Determines the inactivity timeout before the server breaks the connection.
    Syntax
    'Declaration
     
    Public Property ClientInteractive As Boolean
    public bool ClientInteractive {get; set;}

    Property Value

    If true, the server breaks the connection after number of seconds specified in interactive_timeout sever variable, otherwise wait_timeout is used. The default value is false.
    Remarks
    The interactive_timeout and wait_timeout variables can be set in my.ini file.
    Example
    The following example demonstrates usage of this property.
    static void Main(string[] args) {
    
            MySqlConnectionStringBuilder connStrBuilder = new MySqlConnectionStringBuilder();
            connStrBuilder.UserId = "root";
            connStrBuilder.Password = "";
            connStrBuilder.Host = "localhost";
            connStrBuilder.Port = 3306;
            connStrBuilder.Database = "test";
            connStrBuilder.Pooling = false;
            connStrBuilder.ClientInteractive = true;
    
            MySqlConnection myConn = new MySqlConnection(connStrBuilder.ToString());
            MySqlCommand command = new MySqlCommand("select 1", myConn);
            myConn.Open();
    
            //If interactive_timeout is set to a value less than 60, the command will throw exception:
            //Lost connection to MySQL server during query
            Thread.Sleep(new TimeSpan(0, 0, 60));
            try {
                    command.ExecuteNonQuery();
            }
            catch (MySqlException e) {
                    if (e.Code == 2013)
                            Console.WriteLine(e.Message);
            }
    }
    Sub Main()
            Dim connStrBuilder As MySqlConnectionStringBuilder = New MySqlConnectionStringBuilder()
            connStrBuilder.UserId = "root"
            connStrBuilder.Password = ""
            connStrBuilder.Host = "localhost"
            connStrBuilder.Port = 3306
            connStrBuilder.Database = "test"
            connStrBuilder.Pooling = False
            connStrBuilder.ClientInteractive = True
    
            Dim myConn As MySqlConnection = New MySqlConnection(connStrBuilder.ToString())
            Dim command As MySqlCommand = New MySqlCommand("select 1", myConn)
            myConn.Open()
    
            'If interactive_timeout is set to a value less than 60, the command will throw exception:
            'Lost connection to MySQL server during query
            Thread.Sleep(New TimeSpan(0, 0, 60))
            Try
                    command.ExecuteNonQuery()
            Catch ex As MySqlException
                    If (ex.Code = 2013) Then
                            Console.WriteLine(ex.Message)
                    End If
            End Try
    End Sub
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also