[freetds] Function sequence error from Linux => SQL Server 2000

Charles Bearden Charles.F.Bearden at uth.tmc.edu
Wed Apr 28 12:41:12 EDT 2004


I'm new to the ODBC world.  I am attempting to migrate a Python program
with mx.ODBC & WinXP MS SQL drivers to Linux.  I would like to run them
on a RH9 machine under Python 2.3.3 and FreeTDS with the iODBC driver
manager.  The target server is running SQL Server 2000.  When I try to
load a chunk of Unicode into an ntext field in some records, the program
raises an exception due to a "function sequence error".

I have built and installed the following:

  mxBase-2.0.5
  mxCommercial-2.0.6
  libiodbc-3.51.2
  freetds-0.62.3

My etc/freetds.conf file correctly defines the server, and my .odbc.ini
file defines the databases I use on that server.  I am using 'tds
version = 8.0', though changing to 7.0 makes no difference.  The program
takes a stream of PubMed XML records, parses them with SAX, and for each
record loads some of the elements into a series of tables (both data &
junction tables), and takes the accumulated XML record and loads it into
another table.  Certain records cause the script to throw an exception,
like so:

    try: self._cur['xml'].execute('{call pm_CiteXmlChkIns(?,?)}', (pmid,
xml))
mxODBC.InternalError: ('S1010', 0, '[iODBC][Driver Manager]Function
sequence error', 2363)

where 'pmid' is the PubMed ID and 'xml' is the XML data of the record.
'pm_CiteXmlChkhIns' is a stored procedure that checks for the existence
of a row with the given PMID, and, if it exists, updates the XML column
with the new data, and if it doesn't, inserts a new row with the PMID
and XML data.  This stored proc is a "glue" proc and calls other procs
that check, update, and insert.

The error is specific to particular records.  In one file, it is the
11th record; in another, the 142nd (which also means that 141 records
are successfully loaded before the error occurs).  There is no obvious
difference between the problem records and their predecessors that load
happily.  The records are all valid XML, though since I'm just loading
them as chunks of Unicode, that shouldn't matter.  I successfully loaded
the same records (almost 400,000 in all) to the same db under Windows
with mx.ODBC and WinXP's drivers and driver manager.  The only
difference between the Windows & Linux versions of the program is that I
diddle the sys.path in Linux to find my copies of the libraries, and I
'import mx.ODBC.iODBC as mxodbc' instead of 'import mx.ODBC.Windows as
mxodbc'.

I not even sure what a function sequence error is, much less what could
cause it.  Perhaps the driver doesn't like something about the way
pm_CiteXmlChkIns calls the other procedures?  But it also calls this
procedure for the records that succeed.

I can provide a tdsdump.log but didn't want to send it to the list
unless someone wanted to see it.

Cluelessly yours,

Chuck Bearden
Systems Analyst III
School of Health Information Sciences
University of Texas at Houston
713.500.3954 (voice)
713.500.3907 (fax)
Charles.F.Bearden at uth.tmc.edu



More information about the FreeTDS mailing list