?
Solved

Kill Mysql Sleepy Connections with ASP

Posted on 2014-01-14
3
Medium Priority
?
333 Views
Last Modified: 2014-02-01
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.
0
Comment
Question by:garyilm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 33

Expert Comment

by:Big Monty
ID: 39780145
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
 
LVL 33

Expert Comment

by:Big Monty
ID: 39780147
if you've already checked this, you want to disable the autoconnect flag in MySQL, as this may be the problem as well.
0
 
LVL 33

Accepted Solution

by:
snoyes_jw earned 2000 total points
ID: 39794309
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

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question