LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-14-2008, 11:05 AM   #1
incidenta5
LQ Newbie
 
Registered: May 2008
Posts: 2

Rep: Reputation: 0
[mysql/perl] Connection Timeout?


If I keep a single MySQL connection open indefinitely, will it ever time out?

I.e.
Code:
...
$dbh = DBI->connect($dsn, $user, $pass);
while(1)
{
## Several hours with queries every few minutes.
}

$dbh->disconnect;
 
Old 05-14-2008, 05:56 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If you login to MySQL and do

show variables;

you should see a line like this:

| wait_timeout | 28800

default num of seconds after which a cxn will timeout IF there has been no usage/query on that cxn in that time. Timeout is reset after each usage/query.
 
Old 05-15-2008, 05:08 AM   #3
incidenta5
LQ Newbie
 
Registered: May 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks, I tweaked my code so that I have a subroutine to open/close the connection around groups of update/insert queries and that's worked out perfectly
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
perl: can I make the system function timeout? apeekaboo Programming 7 07-24-2007 07:52 AM
Internet connection timeout on Fedora Core 5 using USB connection mike1111 Linux - Networking 0 07-23-2006 09:44 PM
Perl MySQL Connection abdul_zu Programming 3 06-18-2006 02:06 AM
MySQL - Timeout error occurred trying to start MySQL Daemon. stuartornum Linux - Software 3 02-26-2006 12:54 PM
Strange '500 read timeout' with both FireFox and Perl GET on RedHat 9 luckyco Linux - General 0 10-10-2005 05:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration