Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Duplicate
-
None
-
None
Description
MariaDb returns some nulls as collation info.
That crashes the .Net MySql driver and Oracle os not willing to fix their driver.
–
On connect, the driver tries to load collations IDs and cast them to
integers.
However collation is nullable and there are some null-collations, for
example:
+--------------------------------+----------+------+---------+----------+---------+
|
| Collation | Charset | Id | Default | Compiled
|
| Sortlen |
|
+--------------------------------+----------+------+---------+----------+---------+
|
|
| uca1400_ai_ci | NULL | NULL | NULL | Yes
|
| 8 |
|
| uca1400_ai_cs | NULL | NULL | NULL | Yes
|
| 8 |
|
| uca1400_as_ci | NULL | NULL | NULL | Yes
|
| 8 |
|
| uca1400_as_cs | NULL | NULL | NULL | Yes
|
| 8 |
|
So the driver fails to connect the database:
InvalidCast_FromDBNull: Object cannot be cast from DBNull to other
types.
Driver has the following code:
MySqlCommand mySqlCommand = new MySqlCommand("SHOW COLLATION", |
connection);
|
try |
{
|
using MySqlDataReader mySqlDataReader = |
mySqlCommand.ExecuteReader();
|
CharacterSets = new Dictionary<int, string>(); |
while (mySqlDataReader.Read()) |
{
|
CharacterSets[Convert.ToInt32(mySqlDataReader["id"], |
NumberFormatInfo.InvariantInfo)] =
|
mySqlDataReader.GetString(mySqlDataReader.GetOrdinal("charset")); |
}
|
}
|
catch (Exception ex) |
{
|
MySqlTrace.LogError(ThreadID, ex.Message);
|
throw; |
}
|
–
See e.g.: https://bugs.mysql.com/bug.php?id=109331
Attachments
Issue Links
- duplicates
-
MDEV-31608 MySQL.Data can not connect to MariaDB 11 due a collations with a NULL id.
-
- Closed
-
- is caused by
-
MDEV-27009 Add UCA-14.0.0 collations
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Key |
|
|
Issue Type | Improvement [ 4 ] | Bug [ 1 ] |
Project | MariaDB Connector/C [ 10300 ] | MariaDB Server [ 10000 ] |
Assignee | Georg Richter [ georg ] |
Link |
This issue is caused by |
Description |
MariaDb returns some nulls as collation info.
That crashes the .Net MySql driver and Oracle os not willing to fix their driver. -- On connect, the driver tries to load collations IDs and cast them to integers. However collation is nullable and there are some null-collations, for example: +--------------------------------+----------+------+---------+----------+---------+ | Collation | Charset | Id | Default | Compiled | Sortlen | +--------------------------------+----------+------+---------+----------+---------+ | uca1400_ai_ci | NULL | NULL | NULL | Yes | 8 | | uca1400_ai_cs | NULL | NULL | NULL | Yes | 8 | | uca1400_as_ci | NULL | NULL | NULL | Yes | 8 | | uca1400_as_cs | NULL | NULL | NULL | Yes | 8 | So the driver fails to connect the database: InvalidCast_FromDBNull: Object cannot be cast from DBNull to other types. Driver has the following code: MySqlCommand mySqlCommand = new MySqlCommand("SHOW COLLATION", connection); try { using MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader(); CharacterSets = new Dictionary<int, string>(); while (mySqlDataReader.Read()) { CharacterSets[Convert.ToInt32(mySqlDataReader["id"], NumberFormatInfo.InvariantInfo)] = mySqlDataReader.GetString(mySqlDataReader.GetOrdinal("charset")); } } catch (Exception ex) { MySqlTrace.LogError(ThreadID, ex.Message); throw; } -- See e.g.: https://bugs.mysql.com/bug.php?id=109331 |
MariaDb returns some nulls as collation info.
That crashes the .Net MySql driver and Oracle os not willing to fix their driver. -- On connect, the driver tries to load collations IDs and cast them to integers. However collation is nullable and there are some null-collations, for example: {noformat} +--------------------------------+----------+------+---------+----------+---------+ | Collation | Charset | Id | Default | Compiled | Sortlen | +--------------------------------+----------+------+---------+----------+---------+ | uca1400_ai_ci | NULL | NULL | NULL | Yes | 8 | | uca1400_ai_cs | NULL | NULL | NULL | Yes | 8 | | uca1400_as_ci | NULL | NULL | NULL | Yes | 8 | | uca1400_as_cs | NULL | NULL | NULL | Yes | 8 | {noformat} So the driver fails to connect the database: InvalidCast_FromDBNull: Object cannot be cast from DBNull to other types. Driver has the following code: {code:c#} MySqlCommand mySqlCommand = new MySqlCommand("SHOW COLLATION", connection); try { using MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader(); CharacterSets = new Dictionary<int, string>(); while (mySqlDataReader.Read()) { CharacterSets[Convert.ToInt32(mySqlDataReader["id"], NumberFormatInfo.InvariantInfo)] = mySqlDataReader.GetString(mySqlDataReader.GetOrdinal("charset")); } } catch (Exception ex) { MySqlTrace.LogError(ThreadID, ex.Message); throw; } {code} -- See e.g.: https://bugs.mysql.com/bug.php?id=109331 |
Link |
This issue duplicates |
Component/s | Protocol [ 14604 ] | |
Fix Version/s | N/A [ 14700 ] | |
Resolution | Duplicate [ 3 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Is there a reason the https://github.com/mysql-net/MySqlConnector and MariaDB Connector/J are unacceptable solutions?