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.

7 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

Hinterlasse eine Antwort