I am using
- pyodbc 3.0.3
- python 2.7.12
- GNU/Linux 4.4.0-59-generic x86_64
- Ubuntu 16.04.1 LTS (Xenial Xerus)
- unixODBC 2.3.1
- ODBC 5.3(w) Driver
When a try to pass a Unicode database name in the connection string I get the error
A Unicode connection string was supplied but the driver does not have a Unicode connect function
My Code looks like this
# -*- coding: utf-8 -*-
import pyodbc
dbname = u"डाटाबेस"
cstring = "DRIVER={MySQL};SERVER=192.168.8.25;PORT=3306;DATABASE="+dbname+";UID=root;PWD=root;CHARSET=utf8;" \
"use_unicode=1"
connect = pyodbc.connect(cstring)
Edit 1:
I have updated the pyodbc to 4.0.21 version. The above error went aways but got another problem
import pyodbc
dbname = u"डाटाबेस"
cstring = "DRIVER={MySQL};SERVER=192.168.2.243;PORT=3306;DATABASE="+dbname+";UID=root;PWD=support@immune;CHARSET=utf8;" \
"use_unicode=1"
connect = pyodbc.connect(cstring, encoding='utf-8')
When I run this I got following error
error=('HY000', u"[HY000] [unixODBC][MySQL][ODBC 5.3(w) Driver]Unknown database '\xe0\xa4\xa1\xe0\xa4\xbe\xe0\xa4\x9f\xe0\xa4\xbe\xe0\xa4\xac\xe0\xa5\x87\xe0\xa4\xb8' (1049) (SQLDriverConnect)")
pip install pyodbc==4.0.21
and see if that helps. – Gord Thompson