[egenix-users] mxODBC Cursor Unicode issue with method executedirect().

Cliff Xuan Cliff.Xuan at artsalliancemedia.com
Tue Aug 7 15:26:51 CEST 2007

I had a problem when using unicode object in mxODBC Cursor's executedirect() method.

These are the lines from my test code:

u'\xe5' is the Unicode object for Norwegian vow å, spFindUser is a MS SQLServer stored procedure which returns the columns which contains the character in the parameter. 

Method execute() returns the right result, but executedirect doesn't.


con = mx.ODBC.Windows.DriverConnect(dsn)


selectsql = "{call spFindUser(?)}"

cur.execute(selectsql, (u'\xe5'))

cur.executedirect(selectsql, (u'\xe5'))


Any idea why it's happening?

This is the explanation of method executedirect() in the official documentation:



Just like .execute(), except that no prepare step is issued and the operation is not cached. This can result in better performance with some ODBC driver setups, but also implies that Python type binding mode is used to bind the parameters.

operation may be a Unicode object in case the ODBC driver and/or database support this.

Return values are not defined.


One questions on this:  

What does 'prepare step' mean?


Many thanks



-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman-archives/egenix-users/attachments/20070807/05e354fa/attachment.htm

More information about the egenix-users mailing list