[egenix-users] Problem with cursor.information

M.-A. Lemburg mal at egenix.com
Wed Aug 17 11:45:18 CEST 2005


Bernhard Snizek wrote:
> Hi,
> 
>  I am currently evaluating mxODBC for a medium size database 
> integration project where I use Z3.
> 
> I want to connect to an Access .mdb file via mdbtools <-> unixODBC <- >
> mxODBC.unixODBC <-> Zope3 [freeBSD]
> 
> Everything works fine, I can establish a connection and even fetch 
> records BUT cursor.information contains only tuples where the column  id
> is empty.
> 
>>>> import mx
>>>> import mx.ODBC
>>>> import mx.ODBC.unixODBC
>>>> mx.ODBC.unixODBC.DriverConnect('DSN=myDSN')
>>>> dc = dn.cursor()
>>>> dc.execute('select * from kvarter')
>>>> dc.fetchone()
> (50, 'Br\xf8nsh\xf8j')
>>>> dc.description
> (('', 4, None, None, 4, 0, 0), ('', 12, None, None, 100, 0, 1))
> 
> I changed my setup to an iODBC connection, the result is the same, 
> empty column id's.
> 
> When I open the DSN by using isql and execute the same sql statement  as
> above it returns the column ids properly:

mxODBC uses SQLDescribeCol() to fetch the column name, isql uses
SQLColAttribute(). Both are mapped to a function in the ODBC
driver, so it looks as if the mdbtools ODBC doesn't work
correctly with SQLDescribeCol() and returns empty strings
instead of the true column name.

Note that you often can't compare the isql tools output
to what mxODBC does: isql is a very simplistic tool
to do som quick and dirty queries, it only knows about
strings, nothing else.

If a query works in isql it doesn't mean that mxODBC will
behave in the same way, simply because mxODBC uses a much
more sophisticated approach to interfacing that tries to
avoid data conversion and copying - providing much better
performance than tools which only do string interfacing.

The downside of this is that, in some cases, it also
causes ODBC driver bugs to show which isql doesn't
reveal.

I'd suggest you report this bug to the mdbtools project.

> SQL> select * from kvarter
> +------------
> +-----------------------------------------------------------------------
> ------------------------------+
> | KvarterID  | 
> Kvarter                                                                 
>                             |
> +------------
> +-----------------------------------------------------------------------
> ------------------------------+
> | 1          | 
> Amagerbro                                                               
>                             |
> 
> Looks as if the problem is on mxODBC's side ...
> 
> Is this a bug ?
> Has anyone had the same experience ?
> 
> I will publish my Z3 unixODBCDA as OSS when I got past this hurdle 
> therefore I would highly appreciate any help !!
> 
> with best regards
> 
> Bernhard Snizek
> developer
> headnet.dk
> 
> 
> 
> 
> 
> 
> _______________________________________________________________________
> eGenix.com User Mailing List                     http://www.egenix.com/
> https://www.egenix.com/mailman/listinfo/egenix-users

-- 
Marc-Andre Lemburg
eGenix.com

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