mxODBC + MSSQL = code -9 error (again)

gogo at trust-me.com gogo at trust-me.com
Mon Dec 11 13:49:21 CET 2000


Hello.

I encountered the same problem and compiled a version of mxODBC.dll
that does not throw an error if a type is unknown. Instead it tries to
return a string representation of the value by default.

So the problem starts at line 2039 of mxODBC.cpp that comes with the
package. I added the default behaviour there.

Regards, Gogo.




On Wed, 06 Dec 2000 20:33:35 GMT, Matt <mksql at my-deja.com> wrote:

>I am just starting to use the mxODBC package, and have come across an
>issue that has been posted in the newsgroups before, but I have not yet
>found a solution.
>
>I am using ActiveState Python 2.0 "ActivePython 2.0, build 202
>(ActiveState Tool Corp.) based on Python 2.0 (#8, Oct 19 2000,
>11:30:05) [MSC 32 bit (Intel)] on win32", on a Windows 2000
>Professional PC, and attempting to connect to a Microsoft SQL Server
>7.0 database, using a simple test script adapted from your
>documentation. Thes test script, included below, works fine when
>connecting to an Access database, so I am assuming my installation is
>valid.
>
>But, when I connect to a SQL Server database, and have a result set
>that includes a Unicode character data  (SQLDMO_DTypeUVarchar -9
>Variable length) type, I get the "InterfaceError: SQL type (code -9)
>not implemented" error. This is avoidable since my tables to not use
>Unicode fields, but apparently some of the SQL Server system tables do.
>
>The script below, when run against a MS Access DSN, properly returns a
>list of tables. But it appears the same call against the MS SQL DSN
>returns Unicode data in the result set (in c.tables).
>
>***
>
>import ODBC
>db = ODBC.Windows.Connect('SQLTest','sa')
>c = db.cursor()
>c.execute('select count(*) from testdata')
>c.fetchone()
>c.tables(None,None,None,None)
>ODBC.print_resultset(c)
>c.close()
>db.close()
>
>Traceback (most recent call last):
>  File "d:\python20\pythonwin\pywin\framework\scriptutils.py", line
>301, in RunScript
>    exec codeObject in __main__.__dict__
>  File "D:\Python20\Lib\ODBC\Misc\sqltest.py", line 7, in ?
>    ODBC.print_resultset(c)
>  File "d:\python20\lib\ODBC\ODBC.py", line 75, in print_resultset
>    lines = apply(format_resultset,(cursor,headers),kws)
>  File "d:\python20\lib\ODBC\ODBC.py", line 33, in format_resultset
>    rows = cursor.fetchall()
>InterfaceError: SQL type (code -9) not implemented
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.




More information about the Python-list mailing list