Bug #111326 | An error happened while reading data from the provider: ‘Object cannot be cast f | ||
---|---|---|---|
Submitted: | 8 Jun 2023 7:48 | Modified: | 28 Jun 2023 10:02 |
Reporter: | Guram jalaghonia | Email Updates: | |
Status: | Unsupported | Impact on me: | |
Category: | Connector / NET | Severity: | S1 (Critical) |
Version: | 8.0.32 | OS: | Windows |
Assigned to: | CPU Architecture: | Any |
[8 Jun 2023 7:48]
Guram jalaghonia
[8 Jun 2023 13:39]
Bradley Grainger
The "Object cannot be cast from DBNull to other types" exception is a duplicate of bug #109331. As per comments on that case: * the Oracle MySQL team does not support MariaDB with MySQL Connector/NET (MySql.Data) * users recommend an alternative NuGet package that is compatible
[8 Jun 2023 20:41]
Guram jalaghonia
Dear Bradley Grainger, Thank you so much for your response. I see, the only reason why I decided to contacted MySQL team that before refreshing Database, I used MySQL connector and it worked well. Can you give me more details about NuGet package, what is it, where I can find it and how should I use it? Best Regards, Guram
[8 Jun 2023 22:57]
Bradley Grainger
Guram, If you're receiving this error inside Microsoft Power BI, I think you need to contact the creator of the Connector you're using to connect Power BI to MariaDB. If the connector is advertised as supporting MariaDB, then provide your exception message (and a link to https://bugs.mysql.com/bug.php?id=109331) to let them know that it's not working. Their support team will need to resolve this issue. (If their connector is written in C#, they can switch to the "MySqlConnector" NuGet package in order to fix this issue.) If your Power BI connector doesn't provide support for MariaDB, you will need to find one that does.
[27 Jun 2023 22:18]
Sam Morreel
This problem has arisen in MariaDB versions 10.10.x or so (see -> https://jira.mariadb.org/browse/MDEV-27009) due to the Collation table and the addition of nullable columns. If switching to another connector is not an option, you can apply the following fix to the file mysql-connector-net\MySQL.Data\src\Driver.cs in Method LoadCharacterSetsAsync: if (!Convert.IsDBNull(reader["id"])) { CharacterSets[Convert.ToInt32(reader["id"], NumberFormatInfo.InvariantInfo)] = reader.GetString(reader.GetOrdinal("charset")); } We're simply checking for the null id value and skipping the hash table add for now. I've tested this with complex T4 Templates in VS.NET 2022 that uses MySql.Data. You'll have to make sure to add the reference to the newly compiled MySql.Data.dll file directly, for any consuming client. Target the .NET 4.x framework if using with T4 templates within VS.NET. Or, for other clients with different framework requirements, generate a NuGet package using VS.NET. Note, you may have to uninstall the official connector to get rid of the GAC entries. I've used the latest source as of Jun 27/2023. Cheers.
[28 Jun 2023 10:02]
Guram jalaghonia
Hello Dear Slam, Thank you so much for your response. I understood that the main problem is updated version of MariaDB. I'm not so tech to understand how to fix the problem. May be it's possible to give me fixed connector? Best regards, Guram