Sunday, January 30, 2011

Re: pyodbc: Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnectW)')

> conn = pyodbc.connect(r"DRIVER={FreeTDS};SERVER=testserver
> \mssql2008;DATABASE=eoffice;UID=erp;PWD=123")

Thanks for your reply, David!
You gave me great advice!
As you suggest, now I my connection is fine!
But there is one another problem occurred!
When I run the Select query, result is non unicode data while select
query reads nvarchar column from mssql database. My code is below:
------------------
import pyodbc
conn = pyodbc.connect(r'DRIVER={FreeTDS};SERVER=testserver
\mssql2008;DATABASE=eoffice;UID=erp;PWD=123;')
crms = conn.cursor()
crms.execute('SELECT cc_Name FROM tblHR_CodeClass')
for line in crms:
print 'cc_Name: %s' % (line.cc_Name)
break
conn.close()
------------------
Result is 'cc_Name: ?????, ???'. But I expected the result would be
'cc_Name: Aймаг, хот' because actual data is 'Aймаг, хот'.

Here is my question: Does the pyodbc library support Unicode?

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.

No comments:

Post a Comment