Solved

Kill Mysql Sleepy Connections with ASP

Posted on 2014-01-14
3
324 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 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 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

860 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