Problems when SQL server gone away

Asked by aaroncio

Hi!
I am doing many simple queries to a server, the problem is when i lost the connection to the server, the query remains blocked and it keep in this way forever, is there a way to stablish a max time to execute and get response of the query?.
I tried doing threads but the result is a many threads blocked

for user_id in ids:
            query = PySQLPool.getNewQuery(DBconnection)
            q = query.query('select id from Users where id = ' + str(user_id))

Thanks!

PD Sorry for my bad english

Question information

Language:
English Edit question
Status:
Solved
For:
PySQLPool Edit question
Assignee:
Nikoleta Verbeck Edit question
Solved by:
aaroncio
Solved:
Last query:
Last reply:
Revision history for this message
Nikoleta Verbeck (nerdynick) said :
#1

Have you tried setting connect_timeout when creating your connection. Value of which it number of secs to timeout at. Currently the default is no timeout or 0.

Revision history for this message
aaroncio (lrc-aaron) said :
#2

I setted connect_timeout=20 and everything goes well!

Thanks!