[egenix-users] Solid: OperationalError()

M.-A. Lemburg mal at egenix.com
Mon Jan 17 17:54:31 CET 2005


Michal Vitecek wrote:
>>>>08S01            Communication link    The communication link between the 
>>>>driver and
>>>>              failure                the data source to which the driver 
>>>>              was
>>>>                                    connected failed before the function 
>>>>                                    completed
>>>>                                    processing.
>>>>
>>>>Even though there any many things that could cause such
>>>>an error message, I'd suggest starting to check whether a firewall
>>>>is blocking the TCP Port used by the server (e.g. as a result of
>>>>an Win XP SP2 upgrade).
>>>
>>>i'm running this on Slackware 10.0, no firewall is present on that
>>>computer and the communication is done via unix sockets. so this
>>>doesn't seem like the problem. also the computer i'm running it on is
>>>not loaded at all (184 processes, load average 0.00, file-nr 1389  91
>>>52313).
>>>
>>>again this doesn't happen with python 2.2 (at least it hasn't for 2
>>>years). there's nothing in the solid's error or message log.
>>
>>There shouldn't be any differences between Python 2.2 and 2.3
>>versions of mxODBC. However, it is possible that the versions
>>you compiled pick up different drivers or configuration files.
> 
> 
>  i have egenix-mx-commercial 2.1b02 which uses the old way of
>  configuration (one has to edit the mxCOMMERCIAL.py file). there's only
>  one Solid library on that computer. also there's only python 2.4
>  installed, but it behaves the same with python 2.3 even though doesn't
>  with python 2.2.
 >
>>The error you are seeing is generated by the ODBC driver not
>>mxODBC and the result of executing the statement (not the prepare
>>or binding step).
> 
> 
> 
>>If you're using domain sockets, please also check the permissions
>>on the socket "files".
> 
> 
>  the permissions are right for sure - as i said - the application (a
>  server actually with each thread having its own database handle) runs
>  all okay for like ~24 hours, then it begins spitting these
>  OperationalError() exceptions and no connection to the database is
>  possible.
> 
>  the only thing that comes to my mind is whether this could be caused
>  by the Solid engine closing the connection because there isn't going on
>  much at the time (the machine is not used most of the time). but mxODBC
>  should be able to catch this kind of problem and report it, right?

mxODBC does report the problem (after all, you are getting an
exception back). Sounds like you running into a timeout
problem. Solid does allow setting a connection timeout, but
according to their docs, this timeout only applies to the
TCP connections.

>  i'm using my own wrapper around direct calls to mxODBC and before each
>  execute() a test on valid connection is performed, so the code looks
>  like:
> 
>     ...
> 
>     if (self.__db.closed):
>         self.__reconnect()
> 
>     try:
>         retVal = self.__cursor.execute(queryString)
>     ...
> 
>  so self.__db.closed should be set when it is a connecion problem i
>  guess.

That flag is only set, if you explicitly close the connection
by calling .close(). There's no generic way of checking whether the
connection still is alive. In ODBC 3.5 MS introduced a new connection
attribute SQL.ATTR_CONNECTION_ALIVE which you could try to use,
but this is not widely support among ODBC drivers yet.

I usually use dummy SQL statements to test for connectivity or
simply issue a .rollback() on the connection before starting
to process a new request.

>  p.s.: i would use 2.0.6 but i wasn't even able to compile it - the new
>  system of configuration is less understandable for me :/

You might want to try using an ODBC manager between mxODBC and
the Solid ODBC driver. Such setups are usually much easier
to administer and maintain (even if there's a small performance
cost to pay).

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 10 2005)
 >>> 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