I have some Python scripts, which retrieve data from a MS-SQL Server
server.  Those scripts used the modules dbi and odbc, which come with
the rest of pywin32-210.win32-py2.5.exe.

Those scripts have been working just fine until a fateful day, in which
I had to access also a table, which had some Hebrew data in its string
fields.  Those nice Hebrew letters turned into question marks in the
Python scripts' output.

Arik Baratz (http://arik.baratz.org/wordpress/) provided me (and the
mailing list) with a script, which uses the Microsoft ActiveX Data
Objects 2.8 Library.
It failed at the line:

win32com.client.gencache.EnsureModule('{DA9159C1-C9D5-4223-81AC-2B1080701D12}',0,1,0)

because win32com.client does not exist in the win32com from
pywin32-210.win32-py2.5.exe, which I used.

Unfortunately, the functions win32com.client.Dispatch() is needed to
establish a connection, and if win32com.client was missing, this
function was missing as well.  So I could not work around just by
commenting out the EnsureModule() test.

Then I tried pymssql (from http://pymssql.sourceforge.net/, version
pymssql-0.8.0.win32-py2.5.exe).  It required me to modify SQL queries
from '?'-based parameters to '%(name)s'-based parameters., and then
failed to retrieve Unicode strings.

Finally, I tried pyodbc (from http://pyodbc.sourceforge.net/, version
pyodbc-2.0.39.win32-py2.5.exe).  After adjusting the type of timevalues
from dbi.dbiTime to datetime.datetime, pyodbc worked for me, by
providing Unicode strings.
                                      --- Omer
-- 
In civilized societies, captions are as important in movies as
soundtracks, professional photography and expert editing.
My own blog is at http://www.zak.co.il/tddpirate/

My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS:  at http://www.zak.co.il/spamwarning.html

_______________________________________________
Python-il mailing list
[email protected]
http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il

לענות