MySQL Exception: Illegal mix of collations

Today I ran into the problem, that I got an exception which I never got before:
When I tried to login my application which uses Spring and Acegi for security, I got in the logfiles:

2006-06-06 07:56:10,855 DEBUG [http-8080-Processor24] org.acegisecurity.ui.AbstractProcessingFilter: Authentication request failed: org.acegisecurity.AuthenticationServiceException: PreparedStatementCallback; uncategorized SQLException for SQL [SELECT username,password,enabled FROM users WHERE username = ?]; SQL state [HY000]; error code [1267]; Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation ‚=‘; nested exception is java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation ‚=‘; nested exception is org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [SELECT username,password,enabled FROM users WHERE username = ?]; SQL state [HY000]; error code [1267]; Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation ‚=‘; nested exception is java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation ‚=‘

The reason was, that I changed the default CharacterSet on the mySQL Server to UTF8 for another application.

After googleing a bit I found the following solutions:
in my hibernate.cfg I had to add the following properties: utf8 utf8_unicode_ci

Additionally all the mysql columns had to be altered to use charset UTF8 and Collation utf8_unicode_ci

After that it worked.

Dieser Beitrag wurde unter Allgemein, Software-Development veröffentlicht. Setze ein Lesezeichen auf den Permalink.

11 Antworten auf MySQL Exception: Illegal mix of collations

  1. Pingback: Kasper Suits

  2. Pingback: How to get 360 waves

  3. Pingback: anne rice

  4. Pingback: engelhard silver bars

  5. Pingback: Kasper Suits

  6. Pingback: OpenOffice Download

  7. Pingback: jeux de carte

  8. I’m usually to blogging and i actually respect your content. The article has actually peaks my interest. I’m going to bookmark your website and keep checking for brand new information. sale Mac cosMetics

  9. I’am impressed, I must say. Actually not often do I encounter a weblog thats both educative and entertaining, and let me inform you, you have hit the nail on the head. Your idea is outstanding; the issue is something that not sufficient individuals are talking intelligently about. I am very completely happy that I stumbled across this in my seek for one thing regarding this. Cheap mac Cosmetics

  10. Beau sagt:

    Remarkable issues here. I am very glad to see your post. Thank you so much and I’m having a look forward to touch you. Will you kindly drop me a mail?|

  11. Jordan sagt:

    I feel everyone is Very much acquainted with running a blog and how oneself can enhance traffic with it. Timely short article is the key to a effectively operating blog. To commence, you initially need to pick relevant site application.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

CAPTCHA-Bild

*