RestoreMonarchyPlugins / UPets

Ever wanted a pet? In unturned? Following you around? Here you got one!
https://restoremonarchy.com/plugins/upets
MIT License
3 stars 1 forks source link

MariaDB connection error #1

Closed d3adwolf closed 11 months ago

d3adwolf commented 2 years ago
[19:38:10 ERR][RocketMod] Failed to load UPets, unloading now... :
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in <695d1cc93cca45069c528c15c9fdd749>:0
  at MySql.Data.MySqlClient.MySqlField.SetFieldEncoding () [0x00034] in <c020c489676c4d0e9e115b242bef7ab4>:0
  at MySql.Data.MySqlClient.MySqlField.set_CharacterSetIndex (System.Int32 value) [0x00007] in <c020c489676c4d0e9e115b242bef7ab4>:0
  at MySql.Data.MySqlClient.NativeDriver.GetColumnData (MySql.Data.MySqlClient.MySqlField field) [0x000ad] in <c020c489676c4d0e9e115b242bef7ab4>:0
  at MySql.Data.MySqlClient.NativeDriver.GetColumnsData (MySql.Data.MySqlClient.MySqlField[] columns) [0x00004] in <c020c489676c4d0e9e115b242bef7ab4>:0
  at MySql.Data.MySqlClient.Driver.GetColumns (System.Int32 count) [0x0001c] in <c020c489676c4d0e9e115b242bef7ab4>:0
  at MySql.Data.MySqlClient.ResultSet.LoadColumns (System.Int32 numCols) [0x00000] in <c020c489676c4d0e9e115b242bef7ab4>:0
  at MySql.Data.MySqlClient.ResultSet..ctor (MySql.Data.MySqlClient.Driver d, System.Int32 statementId, System.Int32 numCols) [0x0002a] in <c020c489676c4d0e9e115b242bef7ab4>:0
  at MySql.Data.MySqlClient.Driver.NextResult (System.Int32 statementId, System.Boolean force) [0x00039] in <c020c489676c4d0e9e115b242bef7ab4>:0
  at MySql.Data.MySqlClient.MySqlDataReader.NextResult () [0x000d5] in <c020c489676c4d0e9e115b242bef7ab4>:0
  at MySql.Data.MySqlClient.MySqlDataReader.Close () [0x00039] in <c020c489676c4d0e9e115b242bef7ab4>:0
  at MySql.Data.MySqlClient.MySqlDataReader.Dispose (System.Boolean disposing) [0x00003] in <c020c489676c4d0e9e115b242bef7ab4>:0
  at MySql.Data.MySqlClient.MySqlDataReader.Dispose () [0x00000] in <c020c489676c4d0e9e115b242bef7ab4>:0
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery () [0x0004b] in <c020c489676c4d0e9e115b242bef7ab4>:0
  at Dapper.SqlMapper.ExecuteCommand (System.Data.IDbConnection cnn, Dapper.CommandDefinition& command, System.Action`2[T1,T2] paramReader) [0x0001e] in <51f57a25b85f44c4988211f1f77af0bc>:0
  at Dapper.SqlMapper.ExecuteImpl (System.Data.IDbConnection cnn, Dapper.CommandDefinition& command) [0x0015b] in <51f57a25b85f44c4988211f1f77af0bc>:0
  at Dapper.SqlMapper.Execute (System.Data.IDbConnection cnn, System.String sql, System.Object param, System.Data.IDbTransaction transaction, System.Nullable`1[T] commandTimeout, System.Nullable`1[T] commandType) [0x00018] in <51f57a25b85f44c4988211f1f77af0bc>:0
  at Adam.PetsPlugin.Providers.MySQLPetsDatabaseProvider.Reload () [0x00012] in <fa9a9319d87a4a04a1cb3896e898bc16>:0
  at Adam.PetsPlugin.PetsPlugin.Load () [0x00080] in <fa9a9319d87a4a04a1cb3896e898bc16>:0
  at Rocket.Core.Plugins.RocketPlugin.LoadPlugin () [0x00033] in <59a13feb721848c8b0cd173f6d0e820b>:0


I migrated the database from MySQL to MariaDB, then there was an error. Deleting the table did not help. The database uses urf16 as default, as before, the same plugin creates the table in utf8mb4, forced change to utf16 does not help.


Tech. Details:

d3adwolf commented 2 years ago

The PlayersPets table is created, but the plugin is unloaded from the Rocket core.

RestoreMonarchy commented 2 years ago

First time I see this error and from what I found on internet it's as you said a problem with encoding. Try to manually execute create table query in your database

CREATE TABLE PlayersPets
(
    AnimalId SMALLINT UNSIGNED NOT NULL, 
    PlayerId CHAR(17) NOT NULL, 
    PurchaseDate DATETIME NOT NULL, 
    CONSTRAINT PK_PlayersPets PRIMARY KEY(AnimalId, PlayerId)
);
d3adwolf commented 11 months ago

I close the issue due to irrelevance, use MySQL again.