[unixODBC-support] Cannot use unixODBC 2.2.14 with MySQL ODBC connector 5.1

Nick Gorham nick at lurcher.org
Wed May 27 17:02:01 BST 2009

Itachi Uchiha wrote:
> So it seems that I am not alone when dealing with this error. In fact 
> I wonder is there anyone successful in using unixODBC 2.2.14 with 
> MySQL ODBC Driver 5.1 yet?
I just took a look at this. The problem is that current versions of 
unixODBC has fixed a long standing bug in isql, if the user name and 
password wasn't supplied, isql passed them to the driver as a empty 
string. This told the driver that there was no user name and password, 
what isql should have done is pass a NULL for the user name and 
password, this is the signal to the driver that the user name and 
password has not been provided, so the driver can choose what to do, 
either look in the ini file, or refuse to connect, or connect without a 
user name/password.

It seems that (looking at the MySQL odbc driver code) the code assumes 
that it will never be passed a NULL, so doesn't check, and proceeds to 
use the value as a pointer, and so seg faults. The seg fault happens in 
util/stringutil.c on line 95, and its called from driver/ansi.c in 
SQLConnect, line 264.

You can see (and check this)

isql -v test
Segmentation fault

isql -v test name pass
[S1000][unixODBC][MySQL][ODBC 5.1 Driver]Access denied for user 
'name'@'database' (using password: YES)
[ISQL]ERROR: Could not SQLConnect

Should be enough for upstream to provide a fix for the driver hopefully.


More information about the unixODBC-support mailing list