MySQL - Server does not support 4-byte encoded UTF8 characters

Discussion in 'ASP.NET / ASP.NET Core' started by davewise42, Jul 27, 2014.

  1. Ever since the upgrade to the newer web servers, I haven't been able to get my asp.net pages to save data to my MySQL database. They all get the error:

    ERROR [HY000] [MySQL][ODBC 5.2(w) Driver][mysqld-4.1.18-standard]Server does not support 4-byte encoded UTF8 characters.; myodbc5w.dll; at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
    at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod)
    at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)
    at System.Data.Odbc.OdbcCommand.ExecuteNonQuery()

    Is there a setting I'm missing or do I need to connect using something other than ODBC?
     
  2. martino

    martino DiscountASP.NET Staff

  3. I found that page as well, but unfortunately I'm not trying to use any special characters. The same exact code worked before the migration so I'm guessing it's an issue with the ODBC driver. I've searched on the discountasp.net site for info on what drivers are available but couldn't find much. I did find an old post mentioning "mySQL .NET connector". Has anyone used that? Does anyone know what version Discountasp.net has on the servers?
     
  4. martino

    martino DiscountASP.NET Staff

    mjp likes this.
  5. Right, that's the one reference I found which is why I'm using the 5.2w driver (as found in the error message above). Do the IIS 8 servers support anything else such as MySQL .net connector? I cannot seem to get the issue above resolved with the 5.2w driver. The same code worked on the old server with old ODBC driver; all I changed was the connection string after the migration.
     
  6. martino

    martino DiscountASP.NET Staff

    If your site is on our IIS 7 server you should use MySQL ODBC 5.1 Driver
    Is your site on our IIS 8 server? What version of MySQL database are you using by the way? Do you know if you're using the newer version or MySQL version 4?

    As for the MySQL .net Connector, you can upload the dll file into the bin directory and you will be able to use it for your application: http://stackoverflow.com/questions/3877006/where-can-i-find-mysql-data-dll-for-c-sharp
     
    mjp likes this.
  7. My site is on the IIS 8 server. According to MySQL Administrator, the database server is running 4.1.18.
     
  8. You wouldn't happen to have a link you can give us to see this error message.
     
  9. The error message I get is above in my first post.
     
  10. martino

    martino DiscountASP.NET Staff

    You should consider first creating a backup of your current MySQL database using the MySQL Administrator and than go ahead and create a new MySQL database through our control panel and restore the MySQL database onto the new MySQL database. This will provide you with the latest version of the MySQL database we support. The problem might be coming from your older MySQL database you're currently using.
     
  11. Thanks for the suggestion! I was wondering how I can upgrade the database with my account. Looks like between the MySQL .net Connector and upgrading the database I have two possible approaches.
     
  12. martino

    martino DiscountASP.NET Staff

    Depending on how much MySQL disk space you have free. You should be able to create a new MySQL database in the control panel here: https://my.discountasp.net/mysql.aspx

    Once you create the MySQL database our system will automatically create the MySQL database on the higher version.

    With MySQL Administrator you will need to create the backup of your older MySQL database. This should create a .sql file I believe.

    With MySQL Administrator, go ahead and connect to the new MySQL database and restore that .sql file onto the new MySQL database.

    Note: You must use MySQL Administrator to backup your older MySQL database because it doesn't work with MySQL Workbench. :(
     
    andcon and mjp like this.
  13. Oops, just remembering how to do that backup finally....
     
    Last edited: Aug 5, 2014
    andcon likes this.

Share This Page