using System; using MySql.Data.MySqlClient; class issue40684 { const string dsn = "Server=192.168.1.50;" + "User=root;" + "Password=password;" + "Pooling=True;" + "Connect Timeout=3"; static void Log(string msg) { Console.Out.WriteLine(DateTime.UtcNow.ToLongTimeString() + " " + msg); } static void FetchConnection() { try { MySqlConnection c = new MySqlConnection(); c.ConnectionString = dsn; Log("Fishing connection..."); c.Open(); Log("Success (id: " + c.ServerThread + "). Checking state..."); Log("Done (state: " + c.State.ToString() + "). Releasing connection..."); c.Close(); } catch (Exception e) { Log("Exception: " + e.Message); throw; } } static void Main(string[] args) { Log("Info: " + dsn.Substring(dsn.IndexOf("Connect Timeout"))); FetchConnection(); Console.Out.WriteLine("\nReady to fish connection a second time - press ENTER."); Console.In.ReadLine(); FetchConnection(); } }