[Twisted-Python] Re: adbapi and ConnectionLost.

Don Dwiggins ddwiggins at advpubtech.com
Thu Jan 15 12:28:22 EST 2009

Sébastien HEITZMANN wrote:
> Hi,
> for a couple of week i search how i should handle mysql disconnection on
> my twisted web service. When I restart the database without restarting
> my service i got some ConnectionLost fired. I have used the cp_reconnect
> on the connection pool and it seem to work ( the lost connection is
> restarted ) but the current query isn't executed.

I ran into a similar thing using mssql with adbapi (through pyodbc). 
The adbapi connection pool holds connections open and uses them to do 
the access, which was causing problems when the database (or the network 
connection between my server and the database) was reset between 
accesses to my service.  I hacked a workaround by creating a thin 
wrapper around adbapi that closes each connection when I'm through with it.

Don Dwiggins
Advanced Publishing Technology

More information about the Twisted-Python mailing list