[egenix-users] OperationalError: ('08S01', 0, '[Microsoft][ODBC SQL Server Driver]Communication link failure', 4612)',)

M.-A. Lemburg mal at egenix.com
Wed Jan 5 20:49:43 CET 2005


Jim Vickroy wrote:
> Howdy,
> 
> Could anyone offer a suggestion as to the cause of the following error:
> 
> OperationalError: ('08S01', 0, '[Microsoft][ODBC SQL Server
> Driver]Communication link failure', 4612)',)
> 
> when trying to perform a table insert operation?
> 
> Some background:
> 
> 	o The error is encountered by long-running processes after "some" period of
> time in
> 		which the inserts are successfully performed.
> 	o Once this error occurs, for a particular process, the same error persists
> until
> 		the process is stopped/restarted -- even though the process is coded to
> get
> 		a fresh connection each time it tries to do an insert to this table.
> 	o At the same time a process is experiencing the above error, it is able to
> successfully
> 		perform inserts and selects against other tables in a different SQL Server
> datastore.

It is possible that the connection timed out, e.g. due
to periods of inactivity on the connection.

You can adjust the connection time out (and many other settings)
using:

from mx.ODBC import Windows
...
# Set connection timeout to 3600 seconds (= one hour)
connection.setconnectoption(Windows.SQL.ATTR_CONNECTION_TIMEOUT, 3600)

The full list of possible options is documented here (SQLSetConnectAttr
function):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcsqlsetconnectattr.asp

All ODBC attributes IDs starting with "SQL_" are available via the
special SQL lookup object that is exported by all the mxODBC
subpackages.

Many ODBC drivers also allow specifying the connection
attributes in the connection DSN string in form of additional
attributes. For SQL Server, these are documented here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbcsql/od_odbc_d_4x4k.asp

> Some details:
> 
> 	Microsoft Windows 2000 Server
> 	Microsoft SQL Server 2000 with all of the latest patches
> 	Python v2.3.3
> 	egenix-mx-base-2.0.5.win32-py2.3
> 	egenix-mx-commercial-2.0.6.win32-py2.3

-- 
Marc-Andre Lemburg
eGenix.com

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