.NET Framework does not support character set 'utf8mb3': System.NotSupportedException
P粉063039990
P粉063039990 2023-10-19 17:44:27
0
2
970

I'm trying to run a server with a MySQL database, but I keep getting this huge error and I don't know why.

[21:15:49,107] Server Properties Lookup: Error While Initialization
DOL.Database.DatabaseException: Table DOL.Database.ServerProperty is not registered for Database Connection...
   at DOL.Database.ObjectDatabase.SelectAllObjects[TObject]()
   at DOL.GS.ServerProperties.Properties.get_AllDomainProperties()
   at DOL.GS.ServerProperties.Properties.InitProperties()
   at DOL.GS.GameServer.InitComponent(Action componentInitMethod, String text)```

also this error

[21:15:35,991] ExecuteSelectImpl: UnHandled Exception for Select Query "DESCRIBE `Specialization`"
System.NotSupportedException: Character set 'utf8mb3' is not supported by .Net Framework.
   at MySql.Data.MySqlClient.CharSetMap.GetCharacterSet(DBVersion version, String charSetName)
   at MySql.Data.MySqlClient.MySqlField.SetFieldEncoding()
   at MySql.Data.MySqlClient.NativeDriver.GetColumnData(MySqlField field)
   at MySql.Data.MySqlClient.NativeDriver.GetColumnsData(MySqlField[] columns)
   at MySql.Data.MySqlClient.Driver.GetColumns(Int32 count)
   at MySql.Data.MySqlClient.ResultSet.LoadColumns(Int32 numCols)
   at MySql.Data.MySqlClient.ResultSet..ctor(Driver d, Int32 statementId, Int32 numCols)
   at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlDataReader.Close()
   at MySql.Data.MySqlClient.MySqlCommand.ResetReader()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader()
   at DOL.Database.SQLObjectDatabase.ExecuteSelectImpl(String SQLCommand, IEnumerable`1 parameters, Action`1 Reader)```


P粉063039990
P粉063039990

reply all(2)
P粉647449444

There are updates/NET available for the MySQL connector.

After updating to version 8.0.28 (NuGet package MySql.Data) everything is back to normal.

P粉683665106

In my case, I installed 10.6.4-MariaDB with utf8mb3 by default.

I got the same error when trying to read the table.

I fixed the issue by changing all character set settings in the MariaDB configuration to utf8mb4.

Then dump my database and import it again. This time specify utf8mb4 when creating the database.

So, normal SELECT, UPDATE queries work fine and no more errors occur.

But when my application calls the stored procedure, I keep getting errors.

I think this may be because the stored procedure saves to the information_schema database, which is still utf8mb3 and I can't find a way to change it to >utf8mb4.

After spending a lot of time trying to implement some weird workarounds, I came across this bug report:

Unable to use MariaDB 10.6 from a C# client application:
https://jira.mariadb.org/browse/MDEV-26105?attachmentViewMode=List

A user there said:

MySqlCommand setcmd = new MySqlCommand("SET character_set_results=utf8", conn);
int n = setcmd.ExecuteNonQuery();
setcmd.Dispose();

So I ended up adding this to my VB project before executing the stored procedure:

Dim sqlCommand As New MySqlCommand
sqlCommand.Connection = _MySqlCn
sqlCommand.CommandText = "SET character_set_results=utf8"
sqlCommand.ExecuteNonQuery()

This solved the error for me.

Also, here is what I changed previously in the MariaDB server configuration:

[client]
default-character-set=utf8mb4

[mysql]
default-character-set=utf8mb4

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]

old_mode=
character-set-server = utf8mb4
character-set-client=utf8mb4
collation-server = utf8mb4_unicode_520_ci
init-connect='SET NAMES utf8mb4'
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template