hi everyone, i cant connect to my database wich is on mariadb...
connection is ok with heidi, but i have an error using toad data point and I cant figure out...
could someone help me??
System.InvalidCastException
Object cannot be cast from DBNull to other types.
Stack Trace:
at System.DBNull.System.IConvertible.ToInt32(IFormatProvider provider)
at MySql.Data.MySqlClient.Driver.LoadCharacterSets(MySqlConnection connection)
at MySql.Data.MySqlClient.Driver.Configure(MySqlConnection connection)
at MySql.Data.MySqlClient.MySqlConnection.Open()
at Quest.Toad.MySQL.MySQLConnection.OpenInitialTestConnection()
at Quest.Toad.MySQL.MySQLConnection.DoBeforeConnect()
at Quest.Toad.Db.Connection.Connect(Boolean notify)
at Quest.Toad.Db.Provider.BackgroundConnector.CreateBackgroundConnection()
OK... if you're getting an error message using either of the connectors, and you're sure that the credentials for connection are valid, best to open up a Support Ticket so that Quest engineers can troubleshoot.
The error message "Object cannot be cast from DBNull to other types" means that Toad for MySQL is trying to cast a value that is null to another type. This can happen if the database server returns a null value for a column that is not nullable.
In the case of your problem, Toad for MySQL is trying to connect to a server that is running a new feature called "strict mode". When strict mode is enabled, the database server will return null values for columns that are not nullable.
Toad for MySQL v 8.1.0.296 does not support strict mode. This is why Toad is trying to cast a null value to another type, and is getting the error message "Object cannot be cast from DBNull to other types".
There are two solutions to this problem:
1 Update Toad for MySQL to a version that supports strict mode (that would be Quest).
2 Disable strict mode on the DB server (good luck with that).
I just ran into the same issue. I believe this StackOverflow post might offer all the needed information for Quest to fix the issue on their end.
tldr: MariaDB allows null values for certain fields that used to be non-nullable.. It seems the recommended "fix" is to switch from using MySql.Data.MySqlClient to using MySqlConnector.
It looks like the issue started in MariaDB version 10.10, so using 10.9 can be a workaround until this is resolved on Quest's side.
Hi everyone - we have added this defect to our backlog. We cannot commit to a date yet for the fix. We do have a release planned for December (version 6.2) but engineering has not confirmed yet if this will be in this release.
For a workaround, you should be able to connect using the "ODBC Generic" connector and specifying the ODBC driver specifically.
Hi,
I am facing the trouble and not able to connect to mariaDB 10.11.7 version latest release.
Not able to find any solution yet.. is there any update or fix version i need to download other -version, I am using Toad 7.3.. Can anyone suggest what could be the fix or workaround..
System.InvalidCastException
Object cannot be cast from DBNull to other types.
Stack Trace:
at System.DBNull.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Convert.ToInt32(Object value, IFormatProvider provider)
at MySql.Data.MySqlClient.Driver.LoadCharacterSets(MySqlConnection connection)
at MySql.Data.MySqlClient.Driver.Configure(MySqlConnection connection)
at MySql.Data.MySqlClient.MySqlConnection.Open()
at Quest.Toad.MySQL.MySQLConnection.OpenInitialTestConnection()
at Quest.Toad.MySQL.MySQLConnection.DoBeforeConnect()
at Quest.Toad.Db.Connection.Connect(Boolean notify)
at Quest.Toad.Db.Provider.BackgroundConnector.CreateBackgroundConnection()
Unfortunately, downgrading is not an option for us. We have too many applications using the 10.11 version.
As I mentioned before, my experience with the ODBC workaround shows that it is problematic and has limited functionality, such as not being able to browse stored procedures.