Jump to content

DBNull values

No Response 1.8.8

Ripson013456

Posted

MySql handle raised an exception in 'DatabaseStats v1.8.8' plugin (InvalidCastException: Object cannot be cast from DBNull to other types.)

dFxPhoeniX

Posted

2 minutes ago, Ripson013456 said:

MySql handle raised an exception in 'DatabaseStats v1.8.8' plugin (InvalidCastException: Object cannot be cast from DBNull to other types.)

Can you give me more details, such as when this error occurs and if you load an object such as a null object in the database?

Ripson013456

Posted

The error is showing up as soon as I load the plugin  and the below error is displayed in the console.
MySql handle raised an exception in 'DatabaseStats v1.8.8' plugin (InvalidCastException: Object cannot be cast from DBNull to other types.)4c584f371b44>:0        MySql.Data.MySqlClient.Driver.LoadCharacterSets (MySql.Data.MySqlClient.MySqlConnection connection) [0x00079] in <8d7380b3d3cf4bd8be324c584f371b44>:0  at MySql.Data.MySqlClient.Driver.Configure (MySql.Data.MySqlClient.MySqlConnection connection) [0x00060] in <8d7380b3d3cf4bd8be324c584f371b44>:0 1b44>:0 at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00198] in <8d7380b3d3cf4bd8be324c584f371b44>:0                                                                          at MySql.Data.MySqlClient.MySqlCommand.EndExecuteNonQuery (System.IAsyncResult asyncResult) [0x00022] in <8d7380b3d3cf4bd8be324c584f371b44>:0
  at (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlCommand.EndExecuteNonQuery(System.IAsyncResult)
MySql handle raised an exception in 'DatabaseStats v1.8.8' plugin (KeyNotFoundException: The given key '12548' was not present in the dictionary.)
at (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlCommand.EndExecuteNonQuery(System.IAsyncResult)
  at Oxide.Core.MySql.Libraries.MySql+MySqlQuery.Handle () [0x000f2] in <021a1dba6a754e42a6cc7771fdfee190>:0

dFxPhoeniX

Posted

7 minutes ago, Ripson013456 said:

The error is showing up as soon as I load the plugin  and the below error is displayed in the console.
MySql handle raised an exception in 'DatabaseStats v1.8.8' plugin (InvalidCastException: Object cannot be cast from DBNull to other types.)4c584f371b44>:0        MySql.Data.MySqlClient.Driver.LoadCharacterSets (MySql.Data.MySqlClient.MySqlConnection connection) [0x00079] in <8d7380b3d3cf4bd8be324c584f371b44>:0  at MySql.Data.MySqlClient.Driver.Configure (MySql.Data.MySqlClient.MySqlConnection connection) [0x00060] in <8d7380b3d3cf4bd8be324c584f371b44>:0 1b44>:0 at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00198] in <8d7380b3d3cf4bd8be324c584f371b44>:0                                                                          at MySql.Data.MySqlClient.MySqlCommand.EndExecuteNonQuery (System.IAsyncResult asyncResult) [0x00022] in <8d7380b3d3cf4bd8be324c584f371b44>:0
  at (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlCommand.EndExecuteNonQuery(System.IAsyncResult)
MySql handle raised an exception in 'DatabaseStats v1.8.8' plugin (KeyNotFoundException: The given key '12548' was not present in the dictionary.)
at (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlCommand.EndExecuteNonQuery(System.IAsyncResult)
  at Oxide.Core.MySql.Libraries.MySql+MySqlQuery.Handle () [0x000f2] in <021a1dba6a754e42a6cc7771fdfee190>:0

This error indicates that the column with key 12548 does not exist in the database. Have you made any changes to the plugin? The way the database looks, I assume that you let the plugin create the table and you didn't create it yourself.

All you have to do when you load the plugin is to change the config to MySQL, have a database accessible by the host where the plugin is located and that's it, the tables and the rest are created automatically.

And one more thing, what character set are you using for the database? I recommend utf8mb4_unicode_ci

Ripson013456

Posted

13 minutes ago, dFxPhoeniX said:

This error indicates that the column with key 12548 does not exist in the database. Have you made any changes to the plugin? The way the database looks, I assume that you let the plugin create the table and you didn't create it yourself.

All you have to do when you load the plugin is to change the config to MySQL, have a database accessible by the host where the plugin is located and that's it, the tables and the rest are created automatically.

And one more thing, what character set are you using for the database? I recommend utf8mb4_unicode_ci

Plugin is able to create the tables normally but also throwing the same error to the console and the character set was by default to utf8mb4_general_ci and I even changed it to utf8mb4_unicode_ci but it didn't help.

dFxPhoeniX

Posted

13 minutes ago, Ripson013456 said:

Plugin is able to create the tables normally but also throwing the same error to the console and the character set was by default to utf8mb4_general_ci and I even changed it to utf8mb4_unicode_ci but it didn't help.

Try to check if is some null values on db by executing

SELECT userid FROM yourtable WHERE userid IS NULL;

Can you tell me which version of MySQL you are using?

Also, if you move to SQlite does everything works well?

dFxPhoeniX

Posted

I can make you a database at my host to see if everything is ok, although it will surely work since I already have a server running, but we can try to check.

Ripson013456

Posted

2 minutes ago, dFxPhoeniX said:

Try to check if is some null values on db by executing

SELECT userid FROM yourtable WHERE userid IS NULL;

Can you tell me which version of MySQL you are using?

Also, if you move to SQlite does everything works well?

I am using MariaDB 11.3.2 and I can't move to SQlite as my whole app is running on MySQL and I need to have the logs here to work on my own algorithm. 

dFxPhoeniX

Posted

4 minutes ago, Ripson013456 said:

I am using MariaDB 11.3.2 and I can't move to SQlite as my whole app is running on MySQL and I need to have the logs here to work on my own algorithm. 

If you are using MariaDB then this may be the problem, MariaDB has more changes than MySQL, as it is a fork.  If you have the posibility, I would recommend using MySQL.

I recommend MySQL version 8, older versions are outdated.

I can make the plugin support MariaDB in the next update, but only if the oxide library allows me.

Until then, I recommend using MySQL.

Ripson013456

Posted

1 minute ago, dFxPhoeniX said:

If you are using MariaDB then this may be the problem, MariaDB has more changes than MySQL, as it is a fork.  If you have the posibility, I would recommend using MySQL.

I recommend MySQL version 8, older versions are outdated.

I can make the plugin support MariaDB in the next update, but only if the oxide library allows me.

Until then, I recommend using MySQL.

I was planning a remote database for the server to the database where my app is running and mysql has a ton of issues handling multiple connection threads that being my main reason to switch to mariadb so I believe my only option is to wait for next update then. Also can you let me know if the oxide library supports maridb or not.

dFxPhoeniX

Posted

16 minutes ago, Ripson013456 said:

I was planning a remote database for the server to the database where my app is running and mysql has a ton of issues handling multiple connection threads that being my main reason to switch to mariadb so I believe my only option is to wait for next update then. Also can you let me know if the oxide library supports maridb or not.

I'll try tonight if I have some free time to test MariaDB myself and fix the problem. I'll keep you updated on the changes, if it's resolved quickly I'll upload the update tomorrow on CF.

  • Like 1
dFxPhoeniX

Posted (edited)

The problem is only on version 11+ of MariaDB, I guess, on version 10.4 I tested it and it works, I'm trying to see if I can solve it

Edited by dFxPhoeniX
dFxPhoeniX

Posted

Starting from MariaDB 10.6.1, the primary name for the previous 3-byte UTF character set has been updated to 'utf8mb3'. Consequently, there may be compatibility issues, such as the error 'Character set 'utf8mb3' is not supported by .Net Framework' when interfacing with MySQL.Data.MySqlClient. Additionally, from MariaDB 10.10.1 onwards, the ID field has been made Nullable, potentially resulting in errors like 'Object cannot be cast from DBNull to other types'

So I'm afraid I can not do someting to solve, it is a problem from the mysql library. Downgrade to version 10.4 and will works.

dFxPhoeniX

Posted

Changed Status from Pending to No Response

Changed Fixed In to 1.8.8

1.4m

Downloads

Total number of downloads.

6.9k

Customers

Total customers served.

102.3k

Files Sold

Total number of files sold.

2m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.