[DB-SIG] mxODBC: Function sequence error
mal at egenix.com
Mon May 24 10:49:39 EDT 2004
Thomas Waechter wrote:
> M.-A. Lemburg wrote:
> > Are you using one connection per thread ?
> In our framework, on each connection operate several cursors normally
> having their own thread. So each thread only workes on one connection
> but there can be more threads per connection.
> > Please also make sure that you're using the latest available
> > ODBC drivers for MS Access, since earlier versions are not
> > thread safe.
> think so. I am using Microsoft Access Driver 4.00.6019.00. I installed
> MDAC 2.8 and Jet 4.0 Service Pack 8 (SP8). These should be the newest
> available versions.
> But still the same problem occurs. I mutually excluded all my calls to
> mxODBC to literally serialize them. I expected it to run slow, but the
> threads shouldn't be able to interfere anymore. But still it crashes
> with the same "function sequence error" and works if I only allow one
> thread to be used.
> > No need to recompile: direct is set to 1 if you execute
> > an SQL statement without parameters or you switch to
> > .executedirect().
> At the moment, I haven't got a clue how to work out where the problem
> might be located. Though I encapsulated all calls to mxODBC with
> exclusive locks, I cannot understand how this error can occur.
> Which additional information will the debug option of mxODBC provide? Is
> it worth to try it to find out more about the "function sequence error"?
Try to compile a version of mxODBC with debugging enabled
python setup.py mx_autoconf --enable-debug install
If you then run Python in debug mode (python -d), mxODBC
will write an mxODBC.log file with lots and lots of details
about what is happening.
You can also turn on ODBC level logging in the ODBC manager
to get even more information.
Note that you should avoid mixing connections and cursors
with multiple threads if you are working with flaky or buggy
ODBC drivers. Ideally, each thread should have one connection
and all cursors (there can be more than one per connection)
should execute within that thread.
The reason is that even though the ODBC standard make thread
safety mandatory, a few drivers out there are not 100%
thread-safe. Surprisingly, the MS Access one is one of them.
I'd also suggest to look into using the MSDE 2000 instead of
MS Access: that's basically MS SQL Server 2000 without the
GUIs and gives you a much more robust database backend.
Professional Python Services directly from the Source (#1, May 24 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/
EuroPython 2004, Göteborg, Sweden 13 days left
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the DB-SIG