Index: Connection.cs =================================================================== --- Connection.cs (revision 693) +++ Connection.cs (working copy) @@ -29,6 +29,7 @@ #endif using System.Text; using IsolationLevel=System.Data.IsolationLevel; +using System.Collections.Generic; namespace MySql.Data.MySqlClient { @@ -57,6 +58,10 @@ /// public event MySqlInfoMessageEventHandler InfoMessage; + private static Dictionary globalConnectionStringCache = + new Dictionary(); + + #if MONO2 /// public event StateChangeEventHandler StateChange; @@ -248,8 +253,14 @@ "Not allowed to change the 'ConnectionString' property while the connection (state=" + State + ")."); - MySqlConnectionStringBuilder newSettings = - new MySqlConnectionStringBuilder(value); + MySqlConnectionStringBuilder newSettings = null; + + if (!globalConnectionStringCache.TryGetValue(value, out newSettings)) { + lock (globalConnectionStringCache) { + globalConnectionStringCache[value] = newSettings = new MySqlConnectionStringBuilder(value); + } + } + settings = newSettings; if (driver != null) driver.Settings = newSettings;