Problems when SQL server gone away

Asked by aaroncio on 2011-11-16

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:
Nick Verbeck Edit question
Solved by:
aaroncio
Solved:
2011-11-17
Last query:
2011-11-17
Last reply:
2011-11-16
Nick 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.

aaroncio (lrc-aaron) said : #2

I setted connect_timeout=20 and everything goes well!

Thanks!