[Zope3-dev] Re: rdb: Disappearing Connection

jürgen Kartnaller juergen at kartnaller.at
Wed Dec 28 02:47:44 EST 2005


Dieter Maurer wrote:
> Jim Washington wrote at 2005-12-16 16:23 -0500:
> 
>>...
>>What seems to work for me now is the following as 
>>mysqldbda.adapter.MySQLdbAdapter.isConnected()
>>
>>def isConnected(self):
>>       try:
>>           self._v_connection.ping()
>>       except:
>>           # not connected or ping did not restore MySQL connection
>>           if self._v_connection is not None:
>>               self._v_connection.close()
>>               self._v_connection = None
>>           return False
>>       return True
>>
>>I am not well-versed in the intricacies of conflictError, so what else 
>>should happen here?  I do not see how there would be unresolved 
>>transactions remaining, and the connection I need is now available or 
>>soon will be established.
> 
> 
> "isConnected" is fine as you cite it above.
> 
> However, the action taken (by the caller) when "isConnected" returns
> "False" might be wrong. Reopening and then
> using the connection in this case is safe only
> when the connection was not yet used before in this same transaction.
> 
In my understanding : If ping fails everything else will also fail.

But I don't know what happens in case of a server restart.

Jürgen

-- 

---------------------------------------------------
Jürgen Kartnaller   mailto:juergen_at_kartnaller.at
                    http://www.kartnaller.at
                    http://www.mcb-bregenz.at
---------------------------------------------------



More information about the Zope3-dev mailing list