Monday, January 31, 2011

Re: pyodbc & FreeTDS: Can I work with NVARCHAR column on MSSQL2008

Hi,

I have expirience with pymssql and mssql server, and that works fine (utf-8).

FreeTDS docs says:

"FreeTDS is not fully compatible with multi-byte character sets such as UCS-2. You must use an ASCII-extension charset (e.g., UTF-8, ISO-8859-*)[2].
Great care should be taken testing applications using these encodings. Specifically, many applications do not expect the number of characters returned to exceed the column size (in bytes). "

Did You try utf-8?

Cheers


On Mon, Jan 31, 2011 at 1:39 PM, Orgil <orgilhp@gmail.com> wrote:
Hello.
I have FreeTDS, pyodbc-2.1.8, python-2.6, ubuntu-10.4.
I also have MSSQL2008 database server on Windows7.

My question is: Can I get unicode data from nvarchar column on
Mssql2008 database using pyodbc?
To do this, what does other library or configuration need me?

I use FreeTDS driver to connect with mssql by pyodbc. But I don't know
version of FreeTDS.
How to know the version of FreeTDS?

My current state is, I can connect with mssql. But I can not get
unicode data!
My code is:
-----------------------
       import pyodbc
       conn =
pyodbc.connect(r'DRIVER={FreeTDS};SERVER=10.0.0.61\mssql2008;DATABASE=eoffice_clone;UID=erp;PWD=123;CHARSET=UCS-2;')
       crms = conn.cursor()
       crms.execute("SELECT cc_Name FROM tblHR_CodeClass")
       for line in crms:
           print 'cc_Name:', str(line.cc_Name)
       conn.close()
-----------------------
Expected result is 'cc_Name: Аймаг, хот', but instead
'cc_Name: ?????, ???' comes.

Please, share your experience!

regards,
Orgil

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment