My application has been running for years reading and writing data to several web site databases hosted on a MySQL 5.7 server.
My application also reads and writes to a local MySQL Server running 5.7.
The application creates a federated copy of web-side tables on the local server where updates are performed as necessary. As part of the federation process, the application uses the SHOW CREATE TABLE statement to determine the table structure of the table to be federated locally. This has been running happily for 10 years or so.
Recently;
The web site host has begun to migrate their web site databases to MySQL 8.
So far just one of my sites is affected.
On the affected site, we can no longer call the SHOW CREATE TABLE statement.
The following exception is thrown.
Statement:
SHOW CREATE TABLE `oc_product`;
Exception Object:
Data =
{System.Collections.ListDictionaryInternal}
Keys = {System.Collections.ListDictionaryInternal.NodeKeyValueCollection}
Values = {System.Collections.ListDictionaryInternal.NodeKeyValueCollection}
AssemblyQualifiedName =
"System.Collections.Generic.Dictionary`2, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
TargetSite =
{TValue get_Item(TKey)}
STACK TRACE =
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.ExecuteReader()
at GunSeller._mysql_x.SQLDataset_WithConnection(MySqlCommand Cmd, DataTable& NewDataTable) in C:UsersbenDropboxdevelopmentgitGunShop_1cl_mysql.vb:line 1098
Message =
"The given key was not present in the dictionary."
Currently, I cannot update web-side data because I can’t create a federated copy of web-side tables due to an exception thrown when I run the SHOW CREATE TABKE statement.
**Based on research in this forum **
/questions/41930040/net-mysql-error-the-given-key-was-not-present-in-the-dictionary
I have tried:
-
adding charset=utf8;
SCHOW CREATE TABLE statement still returns the error described above. -
Updating MySQL.data in my .net Application to 8.4
This action resulted in my application failing to connect to the local MySQL Server Version 5.7 -
Downgraded MySQL.Data to 6.10.9
This action resulted in being able to connect to the local MySQL Server Version 5.7, but unable to run the SHOW CREATE TABLE statement as described above.