PDA

View Full Version : mysql_query hang


ck123ck
06-25-2003, 10:20 AM
Hi all:

I had encountered a problem with mysql_query. When mysql_query executed after the database was shutdown, the api will hang for couple of minutes before detecting the mysql server has gone away.

The scenario is that mysql_real_connect will maintain there (without close after query) and send out query if there is any query required. This is to shorten the time and overhead to do connection for every query.

Anyway know any ideas to shorten the time to be hang for executing mysql_query. Please advice.

Looking forward for your answer

raf
06-25-2003, 01:23 PM
Welcome here.

How did you shut the server down? From where are you sending the query (commandline, PHP, ...)?
My first guess would be to check out the mysql_option() --> the interactive-timout
http://www.mysql.com/doc/en/mysql_options.html

ck123ck
06-26-2003, 02:11 AM
Well, I am using c for doing coding. The following is the sequence of the scenario.

1) mysql_real_connect (with mysql_option for timeout 2 seconds).
2) this connection remain connected.
3) go to mysql server and shutdown the server.
4) then send the mysql_query (from c) to mysql_server.
5) mysql-query hangs for couple minutes.

I did tried the interactive timeout but it does not work. Any other option to overcome this scenario?