MySQL with .Net RRS feed

  • Question

  • Hi All,


           am working with webapplication and MySQL . now am facing problem in mysql,if am closing connection object then that object remains in sleep mode so "too Many Connection Problem" can any one please help me.Its urgent



    Thanks in advance



    Tuesday, May 27, 2008 11:57 AM

All replies

  • If you are truly closing the connection in all cases then it would be a bug in the implementation.  However I haven't heard of such an issue.  You should post in the MySql forum on their site.  Your code should look like this in almost all cases:

    Code Snippet

    using(MySqlConnection conn = new MySqlConnection(...))




    When that isn't possible then you should use the following instead:


    Code Snippet

    MySqlConnection conn = null;



    } finally


       if (conn != null)



    Any other code usage can result in dropped connections and could be the cause of your problem.


    Michael Taylor - 5/27/08


    Tuesday, May 27, 2008 12:15 PM
  • if ( conn.State.Equals ( ConnectionState.Open )





    Tuesday, May 27, 2008 1:07 PM