MySqlConnection really not close

Posted by stighy on Stack Overflow See other posts from Stack Overflow or by stighy
Published on 2010-05-21T17:37:24Z Indexed on 2010/05/21 17:40 UTC
Read the original article Hit count: 147

Filed under:
|

Hi guys, i've a huge problem. Take a look to this sample code

private sub FUNCTION1()
      dim conn as new mysqlconnection(myconnstring)
      conn.open
      ---- do something
      FUNCTION2()
      ---- 
      conn.close
end sub

private sub FUNCTION2()
     dim conn as new mysqlconnection(myconnstring)
     .... 
     conn.open
     -- do something
     conn.close
end sub

Despite i close regulary all my connection, they remains "open" on the mysql server. I know this because i'm using MySQL Administration tool to check how many connection i open "line by line" of my source code. In fact i get a lot of time "user has exceeded the 'max_user_connections' resource (current value: 5)" My hoster permit ONLY 5 connection, but i think that if i write GOOD source code, this cannot be a problem. So my question is: why that "damn" connections remain open ?? Thank you in advance!

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about mysql