[egenix-users] Time out problem if you database server goes offline

M.-A. Lemburg mal at egenix.com
Fri Oct 29 10:53:24 CEST 2004


Peter Millar wrote:
> I am using windows mxODBCZopeDA 1.0.8.
> 
> It has been working perfectly.
> 
> I am running zope with a manually added mxodbc connection.
> 
> I have a product that uses this connection.
> 
> Today our database server died.
> 
> The status page of the database adaptor showed that the connection was
> closed, even though I didn't close it.
> 
> I decided to put some error checking in around my code using the
> connection, so that I don't query the db if the connection is dead.
> 
> My code looks like this:
>         #self.dbConnectionId = mxODBCZopeDA connection id
> 
>         dbConnection = getattr(self, self.dbConnectionId)
> 
>         print 'am I there yet'
> 
>         if dbConnection.connected() == 0:
>            results = 'DB CONNECTION IS CLOSED'
>            print results
>            return results
>         else:
>            return dbConnection()
> 
> === END OF CODE ===
> 
> The first print statement prints instantly.
> The problem I have is that it takes forever to print 'DB CONNECTION IS
> CLOSED' I am talking like 5 minutes. WHY??
 >
> I don't have the connect on demand setting set.
> 
> Is there some internal setting where if the connection is stuffed it
> will retry until it gets bored??

The mxODBC Zope DA tries to reconnect if you have set the
connection to open and it finds that the connection has
gone down. The reconnect delay depends on the ODBC driver,
the network connection and the database backend. In any
case, it's beyond the control of the DA.

> Alternatively ... Once we got the machine working, I stopped the
> connection myself and my code returns instantly.
> 
> So there appears to be a problem here!!!

Yes, but it is likely not related to the DA itself.

Which ODBC driver are you using ?

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Oct 29 2004)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the egenix-users mailing list