Kill Mysql Sleepy Connections with ASP

From time to time I find some sleepy connection in my mysql database. Im looking for a way to kill these through an asp page. I am looking for a code sample in asp.
garyilmAsked:
Who is Participating?
 
snoyes_jwConnect With a Mentor Commented:
Or just set mysql's wait_timeout to a smaller value so the problem will take care of itself. The default is 8 hours; change it to 30 or 60 seconds:

SET GLOBAL wait_timeout=30;

http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_wait_timeout
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
sorry to say but the most reliable way to do this is to go through your code and make sure you close each connection manually:

conn.open connectionString

'-- do stuff

if conn.State <> 0 then conn.Close
set conn = nothing
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
if you've already checked this, you want to disable the autoconnect flag in MySQL, as this may be the problem as well.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.