[egenix-users] unixODBC Connect raises NotSupportedError [unixODBC]Option not supported

M.-A. Lemburg mal at egenix.com
Thu Jul 27 16:56:09 CEST 2006


Dear Mr. Frey,

> I am evaluating mxODBC for a data transfer/transformation task from a
> SQLServer 2005 database (running on a Windows2003 server) to a PosgreSQL
> Server (under Debian linux)
> 
> The problem: when I try to connect to the SQL Server through mxODBC with
> the following python statement, I get an mxODBC.NotSupportedError
> exception.
> 
> Details:
> When I execute the statement is
> 
>         Database = import_database('unixODBC')
>         conn = Database.Connect('MSSQLDev0', user='sa', password='***')
> 
> I get the exception
> 
>         mxODBC.NotSupportedError: ('S1C00', 1, '[unixODBC]Option not
> supported', 5921)

This is an error message generated by the ODBC driver (FreeTDS)
that you're using. It complains at mxODBC asking it for
a certain feature.

There are two ways to work-around this:

1. Setup and run mxODBC on the Windows machine and use the standard
   SQL Server ODBC driver and the PostgreSQL ODBC driver on that
   machine.

2. Patch mxODBC to ignore the error from the driver, ie. replace
   these lines in unixODBC/mxODBC.c and reinstall mxODBC:

    /* Mixing SQLGetData with SQLBindColumn: */
    rc = SQLGetInfo(dbc->hdbc,
		    SQL_GETDATA_EXTENSIONS,
		    (SQLPOINTER)value,
		    (SQLSMALLINT)sizeof(value),
		    &value_len);
    mxODBC_SQLCheck(henv,dbc->hdbc,SQL_NULL_HSTMT);
    dbc->getdata_extensions = *(long *)value;

    change the above to:

    value_len = sizeof(value);
    rc = SQLGetInfo(dbc->hdbc,
		    SQL_GETDATA_EXTENSIONS,
		    (SQLPOINTER)value,
		    (SQLSMALLINT)sizeof(value),
		    &value_len);
    if (rc != SQL_SUCCESS) {
	*value = 0;
	value_len = 0;
	dbc->getdata_extensions = 0;
    }
    else {
	dbc->getdata_extensions = *(long *)value;
    }

I'd suggest that you use approach 1, since the FreeTDS ODBC driver
is not all that reliable. It's getting better with each new release,
but we still often get complaints from users that it sometimes
returns empty result sets, munges data or does other weird things
which don't happen with commercial drivers such as the ones
from EasySoft, OpenLink and the others.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jul 27 2006)
>>> 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