Skip to Content.
Sympa Menu

freetds - Re: [freetds] Python Unicode SQL Statements

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Python Unicode SQL Statements
  • Date: Tue, 5 May 2009 16:34:02 +0200

2009/5/5 Michael Trier <mtrier AT gmail.com>:
> Hello,
> I've wrestled with this for several days now and I'm at a loss for
> understanding how to make this work.  I have the following test script:
>
> import pyodbc
> conn =
> pyodbc.connect("Driver=FreeTDS;Servername=vm;UID=sprint;PWD=sprint;Database=sprint;")
> cursor = conn.cursor()
> sql = u"SELECT * FROM test_table;"
> result = cursor.execute(sql)
> print result.fetchall()
>
> If I run it on pyodbc on Windows everything works just fine. Pyodbc seems to
> just pass along the unicode string and MSSQL can deal with it fine.
>
> If I run it on my Mac OSX 10.5.6 with the following chain of pyodbc ->
> FreeTDS -> MSSQL, I get the following results:
>
> Traceback (most recent call last):
>  File "odbctest.py", line 5, in <module>
>    result = cursor.execute(sql)
> pyodbc.ProgrammingError: ('42000', "[42000] [FreeTDS][SQL Server]Could not
> find stored procedure 'AUTO_INCREMEN'. (2812) (SQLExecDirectW)")
>
> It is clearly not understanding the unicode string.  FreeTDS seems to want
> byte codes. If I send it as UTF-8 (or remove the unicode string) then all
> works fine.
>
> Is there any way for me to get the above to work without the conversion to
> byte codes? Such as a way to turn off any sort of conversion on the FreeTDS
> side.
>
> I have a log file if that would help as well.
>

Currently FreeTDS does not support SQLExecDirectW but DM should
convert SQLExecDirectW calls to SQLExecDirect. I don't understand
where "AUTO_INCREMENT' came from "SELECT * FROM test_table;"

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page