2009/9/21 Andrés Gattinoni <andresgattinoni@???>:
>
> Luego de descartar que fuera pánico escénico, me cayó la ficha
> de que lo más lógico es que se le muera la conexión de MySQL y cuando va a
> hacer el insert tira una excepción (que no estaba manejando bien). La
> pregunta es... usando mysqldb.... hay alguna forma de hacer que el objeto se
> vuelva a reconectar?... sino lo voy a tener que hacer yo (o hacer que se
> conecte bajo demanda, que hoy por hoy quizás sea más óptimo)... pero quería
> consultar si ya hay algo propio de la lib, como para no andar reinventando
> la rueda.
>
> Saludos,
>
Tal vez la doc del método ping del objeto connection te de alguna pista:
""
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.
New in 1.2.2: Accepts an optional reconnect parameter. If True,
then the client will attempt reconnection. Note that this setting
is persistent. By default, this is on in MySQL<5.0.3, and off
thereafter.
Non-standard. You should assume that ping() performs an
implicit rollback; use only when starting a new transaction.
You have been warned.
""
Espero que te sirva, aunque por otro lado, dado el bajo costo que
tiene establecer una conexión "fresca", como vos mismo decís, debas
hacer eso.
Saludos.
--
Ernesto Savoretti
---------------------------------------------------------------------
Para dar de baja la suscripcion, mande un mensaje a:
pyar-unsubscribe@???
Para obtener el resto de direcciones-comando, mande un mensaje a:
pyar-help@???
PyAr - Python Argentina - Sitio web:
http://www.python.com.ar/