List:MySQL and .NET« Previous MessageNext Message »
From:Ben Reichelt Date:November 13 2004 11:08pm
Subject:Re: Illegal mix of collations
View as plain text  
I dont think this is a bug.  I just downloaded mysql 4.1.7 with .net
beta 2 and I ran into the same problem you are having.  I think the
problem is that the connection is trying to speak utf8 while the
default collation on the database is latin1.  When I view my tables in
mysql_cc, the comments field says 'latin1_swedish_ci', and if you do a
'Show Create' on the table, this is the last line:

) ENGINE=MyISAM DEFAULT CHARSET=latin1; 

So, to fix the problem, I copied the create scripts for all my tables,
and changed the last line of each table to this:

) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

After I made this change my connection worked fine.  Hope this helps

ben


On Wed, 3 Nov 2004 13:51:27 +0100, Bekkers, Kris
<kris.bekkers@stripped> wrote:
> Hi,
> 
> I reported this as a "bug" a couple of days ago but no answer yet.
> 
> Kris
> 
>         -----Oorspronkelijk bericht-----
>         Van: Vilhelm Heiberg [mailto:vilhelm@stripped]
>         Verzonden: wo 3/11/2004 11:53
>         Aan: dotnet@stripped
>         CC:
>         Onderwerp: Illegal mix of collations
> 
> 
> 
> 
>         I also get the "Illegal mix of collations" error message.
>         Now we are at least 4 who has reported this problem the last few days.
> 
>         I also use .Net Connector Beta 2, and I use MySQL 4.1.3b.
> 
>         It is some fairly simple SQL code:
> 
>               public ArrayList GetCustomers(string prefix)
>               {
>                  MySql.Data.MySqlClient.MySqlConnection connection;
>                  connection = new MySqlConnection(CONNECTIONSTRING);
>                  connection.Open();
> 
>                  string stmt;
>                  stmt = "SELECT id,name ";
>                  stmt += "FROM customer ";
>                  stmt += "WHERE name like '" + prefix + "%' ";
> 
>                  MySqlCommand cmd = new MySqlCommand(stmt, connection);
>                  MySqlDataReader reader = cmd.ExecuteReader();
> 
>         Any solution would be appreciated.
> 
>         Vilhelm Heiberg
>         Exercise Organizer AS
>         vilhelm@stripped
> 
> 
> ****************************************************************************
> Disclaimer:
> This electronic transmission and any files attached to it are strictly
> confidential and intended solely for the addressee. If you are not
> the intended addressee, you must not disclose, copy or take any
> action in reliance of this transmission. If you have received this
> transmission in error, please notify the sender by return and delete
> the transmission.  Although the sender endeavors to maintain a
> computer virus free network, the sender does not warrant that this
> transmission is virus-free and will not be liable for any damages
> resulting from any virus transmitted.
> Thank You.
> ****************************************************************************
>
Thread
Illegal mix of collationsVilhelm Heiberg3 Nov
RE: Illegal mix of collationsKris Bekkers3 Nov
  • Re: Illegal mix of collationsBen Reichelt14 Nov