MySQL Forums
Forum List  »  Connector/ODBC

Re: how to set latin1_general_cs collation in ODBC connection
Posted by: Bogdan Degtyariov
Date: April 23, 2017 08:49PM

Hi Renato,

Setting a collation is a tricky thing.
Currently there is no convenient ways of doing so in MySQL Connector/ODBC.
However, you can try a workaround which might do the job for you.

It will only work with the ANSI version of the driver. This should not be a problem because you are using a single-byte Latin1 character set.
Another important thing is setting the character set to Latin1 (either through the DSN setup dialog or the connection string "CHARSET=latin1").
After that the program, which uses ODBC connection has to execute this query:

set collation_connection = latin1_general_cs;

Please note that it could not be done by specifying the initial statement because the driver will set the character set to Latin1 AFTER executing the initial statement and this will reset the collation to the default latin1_swedish_ci.
So, the only way to override the default collation would be setting it explicitly as I explained.

This is a large stretch and inconvenience. I think the ability to set the collation needs to be added into the driver.

Please let me know if my recommendation was applicable to your situation.

Options: ReplyQuote

Written By
Re: how to set latin1_general_cs collation in ODBC connection
April 23, 2017 08:49PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.