MySQL vs IIS7
Oct 1st, 2009 by Intermanaut
CONCATing strings with numeric fields may return a binary value, depending on the OPTION parameter given in the connection string.
This simple SQL statement SELECT CONCAT(’kibo’, 1);, when run via the MySQL ODBC Connector using the following connection string, returns ???? (yup - four question marks).
Driver={MySql ODBC 3.51 Driver}; Server=localhost; uid=[user]; pwd=[password]; database=[database]; option=3;
You can work around it by CASTing the integer as CHAR, but you’ll have to do that where ever you’re CONCATing strings and integers. This is the expected MySQL behaviour, but IIS6 allowed laziness, and returnsit in a usable form.
Change the connection string to this, and you’ll get kibo1 back.
Driver={MySql ODBC 3.51 Driver}; Server=localhost; uid=[user]; pwd=[password]; database=[database]; option=268435459;
The option value in the second connection string specifies
1 FLAG_FIELD_LENGTH
2 FLAG_FOUND_ROWS
268435456 FLAG_NO_BINARY_RESULT
This also applies to MySQL ODBC Connection v5.x.