[egenix-users] Error from mxODBCZopeDA for Zope 2.12 with Python 2.6 on x86_64

M.-A. Lemburg mal at egenix.com
Tue Feb 16 12:58:12 CET 2010

Baiju M wrote:
> On Fri, Dec 18, 2009 at 3:28 PM, M.-A. Lemburg <mal at egenix.com> wrote:
>> Baiju M wrote:
>>> Hi,
>>>     I am using beta version of mxODBCZopeDA for Zope 2.12 with Python
>>> 2.6 on x86_64.
>>> File: egenix-mxodbc-zopeda-1.0.10.linux-x86_64-py2.4_ucs4.zip
>>> When I am trying to make a query, it shows "ODBC driver sent negative
>>> string size" error.
>>> This is the output from Zope's debug prompt:
>>>>>> app.db._v_database_connection.query("select * from tbl_name")
>>> Traceback (most recent call last):
>>>   File "<stdin>", line 1, in <module>
>>>   File "Products/mxODBCZopeDA/ZopeDA.py", line 1534, in query
>>>   File "Products/mxODBCZopeDA/ZopeDA.py", line 1409, in run_cursor_callback
>>> mx.ODBC.Error.InterfaceError: ODBC driver sent negative string size
>>> I am using "unixODBC 2.2.15pre".  With unixODBC 2.2.14 also this error
>>> is raised.
>>> But in 2.2.14 I cann't even get any result from "isql" command line prompt.
>>> I am connecting to Oracle using instant_client for x86_64
>>> Few other details:
>>> $ uname -a
>>> Linux xxxxxxxxxx 2.6.18-128.el5 #1 SMP Wed Jan 21 10:41:14 EST 2009
>>> x86_64 x86_64 x86_64 GNU/Linux
>>> $ cat /etc/redhat-release
>>> CentOS release 5.3 (Final)
>>> Please let me know if any more details required
>> This appears to be a bug in unixODBC 2.2.14. We've had similar
>> reports for the MySQL ODBC driver used in combination with
>> unixODBC 2.2.14.
>> Please try unixODBC 2.2.12 and see if the problem goes away.
> I forgot to mention, I have tried 2.2.12 also. It was showing the same error.
> FYI, In 2.2.12 & 2.2.14 we are getting this error from "isql":
>   [ISQL]ERROR: Could not SQLAllocStmt
> I can see this error mentioned in Oracle forum:
> http://forums.oracle.com/forums/thread.jspa?threadID=340030&tstart=0

We have now spoken to EasySoft who maintain unixODBC: they apparently
switched two important variable types between the releases
2.2.12 and 2.2.13 of the unixODBC manager.

In 2.2.12, unixODBC defaults to using 32-bit values for the
SQLLEN/SQLULEN types. In 2.2.14, it defaults to 64-bit values.

Unfortunately, they left the library version name at the
same libodbc.so.1.0.0, so the linker won't hint you to a possible
problem with the API change.

Our products are built against unixODBC 2.2.12 and use its
default settings. As a result they use 32-bit values for
all SQLLEN/SQLULEN parameters. When used against a
2.2.14+ unixODBC manager library, the linker won't
complain (it sees the same version on the file), but all
calls will end up creating a garbled stack.

Now, to make things even more interesting, the Oracle driver
for 64-bit Linux uses 64-bit SQLLEN values as well, so you
can't use it with unixODBC 2.2.12, but you should be able
to use it with 2.2.14 or a later version.

Note that iODBC, the other ODBC manager for Unix, still
uses the 32-bit defaults.

We'll have to find a way to make all this just magically
work in some way.

64-bit ODBC is a real mess and the fact that MS changed SQLLEN
from long to long long on Win64 late in the spec process and after
Unix 64-bit platforms had already adopted the 32-bit
interpretation didn't really help either.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Feb 16 2010)
>>> 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 our new mxODBC.Connect Python Database Interface for free ! ::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the egenix-users mailing list