Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26105

MariaDB 10.6 cannot be used from C# client applications




      This is because the character set 'utf8mb3' is not supported by the .Net Framework.
      Since version 10.6 utf8 defaults to utf8mb3 but the this can be prevented by starting the server with the option 'old_mode='.
      However the system character set is utf8mb3 and this cannot be changed. Then each command answered by the system cause the client to crash.
      For instance, using the MyTest C# client (uploaded):

      Chose MariaDB version:6
      Query: drop table t1;
      Query: create table t1 (n int, m varchar(50)) default charset utf8;
      Query: insert into t1 values(1, 'Déjà Noël ?');
      Query: select * from t1;
      System.Int32: n = 1
      System.String: m = Déjà Noël ?
      Query: show create table t1;
      System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
         at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
         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.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
         at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
         at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
         at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
         at MyTest.Program.Main(String[] args) in C:\vc2013\Projects\MyTest\MyTest\Program.cs:line 52
      Press any key to continue . . .

      Setting 'old_mode=' made the t1 table work, but any SHOW commands will crash the client, even a simple command such as:

      select version();

      doesn't work.

      Note: Setting manually the variable character_set_results to anything other then utf8mb3 (which seems to be its default value) avoids these crashed but this should be also the result of the old_mode setting.

      It should be also possible to set the character_set_results variables in my.ini but on Windows 10 trying to do this fails. The server cannot be started saying "unknown variable character_set_results" or "unknow variable character-set-results" depending on what was used in my.ini.
      See MDEV-26107.


        Issue Links



              bar Alexander Barkov
              bertrandop Olivier Bertrand
              6 Vote for this issue
              20 Start watching this issue



                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.