[英]Too Many Connection Error in mysql
i Have one C# desktop application that connects mysql database sever. 我有一个C#桌面应用程序,用于连接mysql数据库服务器。 The applicaiton runs well but after some time or some days it gives an exception like: 该应用程序运行良好,但是经过一段时间或几天后,出现了如下异常:
9/16/2013 12:56:55 PM: 9/16/2013 12:56:55 PM: Exception Occurred. Too many
connections.StackTrace: at MySql.Data.MySqlClient.MySqlStream.OpenPacket()
at MySql.Data.MySqlClient.NativeDriver.Authenticate411()
at MySql.Data.MySqlClient.NativeDriver.Authenticate()
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at ReckonHelper.MySqlDatabaseConnection.ConnectDB().
I don't know why it is being happen?? 我不知道为什么会这样?
Any Solution For this? 有什么解决办法吗?
Close the connection once you have complated the execution of SQL statements. 完成SQL语句的执行后,请关闭连接。
Use try..catch..finally 最终使用try..catch ..
try { ....... con.Open(); //execute sql statement } catch (Exception ex) { throw ex; //throw or dispaly your exception } finally { con.close; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.