Connecting Tech Pros Worldwide Forums | Help | Site Map

How to maintain the MYSQL connection for the whole session.

madhoriya22's Avatar
Familiar Sight
 
Join Date: Jul 2007
Location: India
Posts: 254
#1: Jul 27 '07
Hi,
In my web application I am using Mysql at backend. The problem is If I leaves the application Idle for sometime the connection to Mysql automatically closes.
Is there anyway by which I can maintain the connection for whole session in Mysql.

Thanks and regards,
madhoriya

mwasif's Avatar
Moderator
 
Join Date: Jul 2006
Location: Pakistan
Posts: 719
#2: Jul 27 '07

re: How to maintain the MYSQL connection for the whole session.


Increase mysql connection time out in php.ini, variable is mysql.connect_timeout.
madhoriya22's Avatar
Familiar Sight
 
Join Date: Jul 2007
Location: India
Posts: 254
#3: Jul 27 '07

re: How to maintain the MYSQL connection for the whole session.


Quote:

Originally Posted by mwasif

Increase mysql connection time out in php.ini, variable is mysql.connect_timeout.

Hi mwasif,
I am not using php. I am using using JSP and JDBC. Is it possible through query in Mysql.

Thanks and regards,
madhoriya
mwasif's Avatar
Moderator
 
Join Date: Jul 2006
Location: Pakistan
Posts: 719
#4: Jul 27 '07

re: How to maintain the MYSQL connection for the whole session.


You can change the value in query too
connect_timeout
Use this query to see the connection timeout.
Expand|Select|Wrap|Line Numbers
  1. SHOW VARIABLES LIKE 'connect_timeout';
This query will change the connection timeout to 60 seconds, change the time according to your needs.
Expand|Select|Wrap|Line Numbers
  1. SET GLOBAL connect_timeout=60;
This value will be reset when the MySQL server will be restarted.

Your MySQL must have SUPER priviliges to perform this query.
madhoriya22's Avatar
Familiar Sight
 
Join Date: Jul 2007
Location: India
Posts: 254
#5: Jul 27 '07

re: How to maintain the MYSQL connection for the whole session.


Quote:

Originally Posted by mwasif

You can change the value in query too
connect_timeout
Use this query to see the connection timeout.

Expand|Select|Wrap|Line Numbers
  1. SHOW VARIABLES LIKE 'connect_timeout';
This query will change the connection timeout to 60 seconds, change the time according to your needs.
Expand|Select|Wrap|Line Numbers
  1. SET GLOBAL connect_timeout=60;
This value will be reset when the MySQL server will be restarted.

Your MySQL must have SUPER priviliges to perform this query.

Hi mwasif,
I got it. Thanks.
The value first query is returnin is 5(min/sec i dont know).

Thanks and regards,
madhoriya
mwasif's Avatar
Moderator
 
Join Date: Jul 2006
Location: Pakistan
Posts: 719
#6: Jul 27 '07

re: How to maintain the MYSQL connection for the whole session.


Quote:
The value first query is returnin is 5(min/sec i dont know).
Connection time out value is in seconds.
Newbie
 
Join Date: Aug 2007
Posts: 2
#7: Aug 8 '07

re: How to maintain the MYSQL connection for the whole session.


Greetings all,

I am a very very big Novice/Newbie to any type of scripting..

I am trying to run the SHOW query on my MySQL database but it keeps asking me to select "One" Column before the query will run...

I am not sure what to do... I need to find out the timeout on the Roster Master Module that is running on my Dragonfly CMS...

When I try to parse using the Roster Master module to the SOE guild roster's my database keeps timing out and does not allow me to pull in my guild rosters.

Any help is much appreciated.

Regards,
Newbie
 
Join Date: Aug 2007
Posts: 2
#8: Aug 8 '07

re: How to maintain the MYSQL connection for the whole session.


Quote:

Originally Posted by Sweetbomb

Greetings all,

I am a very very big Novice/Newbie to any type of scripting..

I am trying to run the SHOW query on my MySQL database but it keeps asking me to select "One" Column before the query will run...

I am not sure what to do... I need to find out the timeout on the Roster Master Module that is running on my Dragonfly CMS...

When I try to parse using the Roster Master module to the SOE guild roster's my database keeps timing out and does not allow me to pull in my guild rosters.

Any help is much appreciated.

Regards,

I was able to find the timeout it was 10... I tried the SET GLOBAL but it said that I needed Super privilege to be able to do this command... I sent an message to my host asking for their help with this part..

But, is there any other way that I can add the timeout into my MySQL database without such privileges?

Thanks,
Reply


Similar MySQL Database bytes