Solved

Kill Mysql Sleepy Connections with ASP

Posted on 2014-01-14
3
322 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
  • 2
3 Comments
 
LVL 32

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 32

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 500 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MySQL Select latest stock count records 11 56
MySQL database data submission 7 58
User with DBO permission can't remotely connect 15 45
IP API - need data... 4 11
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now