2
votes

I am unable to connect to MySQL ODBC 8.0 Unicode Driver with unixODBC as underlying driver running on Mac OS.

I am using pyodbc package on python 3.6. Everything works when I use the ANSI driver but the Unicode Driver is not working.

Here are the available drivers installed on my mac.

['MySQL ODBC 8.0 ANSI Driver', 'MySQL ODBC 8.0 Unicode Driver', 'ODBC Drivers', 'ODBC Connection Pooling']

My Connection String

self.connection_string = 'Driver={MySQL ODBC 8.0 Unicode Driver};Server=localhost;Database=db_name;Uid=root;Pwd=P@kistan1;charset=UTF8;Option=3;'

And the error detected by pyodbc.Error is

('H000', '[H000] [ (0) (SQLDriverConnect)')

I am able to establish connection using iODBCAdmin which tells me that the driver is correct.

iODBC Admin

1

1 Answers

0
votes

i don't know why after stmt=SET NAMES 'utf8' it's works but Unicode Driver already there

DRIVER={MySQL ODBC 8.0 Unicode Driver}; SERVER=xxxxx; DATABASE=xxxxx; UID=xxxxx;PASSWORD=xxxxx; OPTION=3; port=3306; stmt=SET NAMES 'utf8';