[ODBC-6] Illegal mix of collations when using parameters Created: 2014-05-05 Updated: 2015-01-14 Resolved: 2014-09-19 |
|
| Status: | Closed |
| Project: | MariaDB Connector/ODBC |
| Component/s: | None |
| Affects Version/s: | 1.0.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Ulf Engstrand | Assignee: | Lawrin Novitsky |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows Server 2008 R2 |
||
| Description |
|
Application fails with the following exception when sending data as parameters. System.Data.Odbc.OdbcException: ERROR [HY000] Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' |
| Comments |
| Comment by Georg Richter [ 2014-05-05 ] | ||||||
|
To analyze the bug I need some more information
Thanks! | ||||||
| Comment by Georg Richter [ 2014-05-08 ] | ||||||
|
If you don't specify a character set in your DSN, utf8 as default is used. Some query fails, since it contains a non latin1 character, e.g.
Either find the statement which contains an invalid latin1 character or use a different character set in your DSN:
| ||||||
| Comment by Ulf Engstrand [ 2014-05-09 ] | ||||||
|
The problem remains, without specifying character set on the DSN: SELECT `value` FROM xmldata WHERE `key` = 'Key1'; <--- Returns OK var cmd = new System.Data.Odbc.OdbcCommand("SELECT `value` FROM xmldata WHERE `key` = ?", conn); However, when specifying character set latin1, the latter does not fail but returns no rows. | ||||||
| Comment by Georg Richter [ 2014-05-19 ] | ||||||
|
Fixed in rev. 21 | ||||||
| Comment by Lawrin Novitsky [ 2014-09-19 ] | ||||||
|
Looks like the issue is still there - I observed same error with ado using parameters. Taking it over for further investigation and fixing | ||||||
| Comment by Lawrin Novitsky [ 2014-09-19 ] | ||||||
|
Ok, looks like I reopened the bug a bit in hurry. Bug occurs if the field is different than the default charset used by the driver. But specifying CHARSET=<charset_used_in_db> perfectly cures the problem. Const adParamInput = &H0001 Const adCmdText = &H0001 Const adVarChar=200 Dim conn, rs, fld, cmd, pr Set conn = CreateObject("ADODB.Connection") conn.Open(DSN) Set cmd = CreateObject("ADODB.Command") Set rs = cmd.Execute() Adding ;CHARSET=cp1251 to the connection string helped in my case(as the key field was in cp1251). |