I've been getting the "raw" connection from the hub (via hub.getConnection().getConnection()) and invoking "ping()" in actions before using the database; if the connection is no longer in place, it will reconnect with the last provided connection settings.
From MySQLdb.connections:
| ping(...)
| Checks whether or not the connection to the server is
| working. If it has gone down, an automatic reconnection is
| attempted.
|
| This function can be used by clients that remain idle for a
| long while, to check whether or not the server has closed the
| connection and reconnect if necessary.
|
| Non-standard.
(The code's that running is based on the 0.5 AutoConnectHub; apologies if things have changed in that arena...!)
Roger
- [TurboGears] Re: Reconnect to the database (mysql) when con... Roger Espinosa