[Urgent] Attention to anyone using LOFT Source

09/23/2008 00:19 tao4229#16
Quote:
Originally Posted by THE BAT View Post
The problem is not in LOTF Database code, you are true the code had one problem, but i fix it, i trace the code, but the problem is in the MySQL .NET Connector, and there are alot of people post it in the mySql forums, the thing is the problem happen randomly
Thats why you reconnect every so often...
09/23/2008 00:25 ~Yuki~#17
Quote:
Originally Posted by THE BAT View Post
The problem is not in LOTF Database code, you are true the code had one problem, but i fix it, i trace the code, but the problem is in the MySQL .NET Connector, and there are alot of people post it in the mySql forums, the thing is the problem happen randomly
Damn right Add me on msn!

[Only registered and activated users can see links. Click Here To Register...]
09/23/2008 01:55 THE BAT#18
Quote:
Originally Posted by lolmaster123 View Post
Damn right Add me on msn!

[Only registered and activated users can see links. Click Here To Register...]
done
09/23/2008 03:54 pegaeu#19
Quote:
Originally Posted by THE BAT View Post
The server is working very fine from more than 15 hours now, without any problem




Here is my old GetCharInfo, i added some changes to it, in trying to stop losing chars, but the problem is with the MySQL .NET Connector, even with the latest version of it (5.2.3)

Code:
       public static void GetCharInfo(Character Charr, string UserName)
        {
            try
            {
                MySqlDataAdapter DataAdapter = null;
                DataSet DSet = new DataSet();                        

                DataAdapter = new MySqlDataAdapter("SELECT * FROM `Characters` WHERE `Account` = '" + UserName + "'", Connection);

                DataAdapter.Fill(DSet, "Character");

                if (DSet != null && DSet.Tables["Character"].Rows.Count > 0)
                {
                    DataRow DR = DSet.Tables["Character"].Rows[0];

                    Charr.UID = (uint)DR["UID"];
                    Charr.Name = (string)DR["CharName"];
                    Charr.Spouse = (string)DR["Spouse"];
                    Charr.Job = Convert.ToByte((uint)DR["Job"]);
                    Charr.Level = Convert.ToByte((uint)DR["Level"]);
                    Charr.Exp = (uint)DR["Exp"];
                    Charr.Model = Convert.ToUInt16((uint)DR["Model"]);
                    Charr.Avatar = Convert.ToUInt16((uint)DR["Avatar"]);
                    Charr.Hair = Convert.ToUInt16((uint)DR["Hair"]);
                    Charr.LocX = Convert.ToUInt16((uint)DR["LocationX"]);
                    Charr.LocY = Convert.ToUInt16((uint)DR["LocationY"]);
                    Charr.LocMap = Convert.ToUInt16((uint)DR["LocationMap"]);
                    Charr.Str = Convert.ToUInt16((uint)DR["Strength"]);
                    Charr.Agi = Convert.ToUInt16((uint)DR["Agility"]);
                    Charr.Vit = Convert.ToUInt16((uint)DR["Vitality"]);
                    Charr.Spi = Convert.ToUInt16((uint)DR["Spirit"]);
                    Charr.Silvers = (uint)DR["Money"];
                    Charr.CPs = (uint)DR["CPs"];
                    Charr.CurHP = Convert.ToUInt16((uint)DR["CurrentHP"]);
                    Charr.CurMP = Convert.ToUInt16((uint)DR["CurrentMP"]);
                    Charr.PKPoints = Convert.ToUInt16((uint)DR["PKPoints"]);
                    Charr.RBCount = Convert.ToByte((uint)DR["RBCount"]);
                    Charr.PackedInventory = (string)DR["Inventory"];
                    Charr.PackedEquips = (string)DR["Equipment"];
                    Charr.PackedSkills = (string)DR["Skills"];
                    Charr.PackedProfs = (string)DR["Profs"];
                    Charr.WHSilvers = (uint)DR["WHMoney"];
                    Charr.PackedWHs = (string)DR["Warehouses"];
                    Charr.PackedFriends = (string)DR["Friends"];
                    Charr.PackedEnemies = (string)DR["Enemies"];
                    Charr.VP = (uint)DR["VP"];
                    Charr.GuildDonation = (uint)DR["GuildDonation"];
                    Charr.GuildID = Convert.ToUInt16((uint)DR["MyGuild"]);
                    Charr.GuildPosition = Convert.ToByte((uint)DR["GuildPos"]);
                    Charr.PrevMap = Convert.ToUInt16((uint)DR["PrevMap"]);
                    if (Guilds.AllGuilds.ContainsKey(Charr.GuildID))
                        Charr.MyGuild = Guilds.AllGuilds[Charr.GuildID];
                    Charr.MinAtk = Charr.Str;
                    Charr.MaxAtk = Charr.Str;
                    Charr.Potency = Charr.Level;
                    Charr.RealModel = Charr.Model;
                    Charr.RealAvatar = Charr.Avatar;
                    Charr.MaxHP = Charr.BaseMaxHP();
                    Charr.MaxMP = Charr.MaxMana();
                    Charr.RealAgi = Charr.Agi;

                    Charr.KO = Convert.ToUInt16((uint)DR["KO"]);
                    Charr.OldKO = Convert.ToUInt16((uint)DR["OldKO"]);
                }
                else
                {
                    General.WriteLine("Char not found.");

                    throw new Exception();
                }
            }
            catch (Exception Exc) 
            {
                Charr = null;
                throw Exc; 
            }
        }


i can give your the modified Database class to work with MS SQL Server, if you want
omg 15 hours :O very nice i need it too
09/23/2008 04:00 tao4229#20
Quote:
Originally Posted by pegaeu View Post
omg 15 hours :O very nice i need it too
Mine works for 15 hours using MySQL, it doesn't take a genius....
09/23/2008 13:39 glupkotrup#21
Haha...
/Agreed mine is working too (well for 12 hours :rolleyes:)
09/23/2008 14:36 lostsolder05#22
Quote:
Originally Posted by tao4229 View Post
Mine works for 15 hours using MySQL, it doesn't take a genius....
ye... mine will work for over 24 hrs str8 with mysql... lol
09/23/2008 14:42 glupkotrup#23
You actually don't understand -_-
09/23/2008 23:50 Rechocto#24
too many long command strings will over load mysql, this is true.. but if you set a quick function up to go off every hour or so, and null out Connection and then reconnect it to MySql, you can stop this problem from happening.
09/24/2008 00:49 tao4229#25
Quote:
Originally Posted by Rechocto View Post
too many long command strings will over load mysql, this is true.. but if you set a quick function up to go off every hour or so, and null out Connection and then reconnect it to MySql, you can stop this problem from happening.
Mine reconnects every like 5 minutes ._. Maybe a wee bit excessive :]
09/24/2008 07:16 Ultimatum#26
Quote:
Originally Posted by THE BAT View Post
The MySQL .NET Connector has a bug, its not happen always, but it happen like 3 or 4 times a day, i search the MySQL Knowledge base and some report that bug too.

look at the errors:

Code:
MySql.Data.MySqlClient.MySqlException: Duplicate entry '' for key 1
   at MySql.Data.MySqlClient.MySqlStream.OpenPacket()
   at MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId)
   at MySql.Data.MySqlClient.MySqlDataReader.GetResultSet()
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
Code:
System.ArgumentException: Column 'UID' does not belong to table Character.
   at System.Data.DataRow.GetDataColumn(String columnName)
   at System.Data.DataRow.get_Item(String columnName)

i suggest if you are planning to release your server to public, move to another database server like SQL Server.

cuz when that problem happen, some character information replace with 0 in the database

1. MySql.Data.MySqlClient.MySqlException: Duplicate entry 'character name' for key 1

How i fixed it: In the accounts column look at charr and replace it with the correct character name. One thing that happens when using /changename. Changes the name in the character column but not the one in the accounts column. Result: that above comes up on the console.....

2. Thats fucked up o.0 never seen that
09/25/2008 17:35 THE BAT#27
Anyway i will stay with SQL Server

Quote:
Security remains a major concern for most businesses and a compelling consideration in choosing a database system.

Both DBMS support security at the base level. MySQL is limited to supporting basic security at the table level, via the SQL command. By contrast, SQL server fully supports security at the column level.

Another important consideration is security certificates - the verification of the database security by a third party. SQL Server has been certified as C-2 compliant, which means the database system has adequate security for government applications. MySQL has no such certification.

Moving on to more advanced features of protecting data on the database, the SQL Server 2005 have implemented more advanced authentication and authorisation features.
Quote:
SQL Server is more failsafe and less prone to data corruption. SQL has a robust checkpoint mechanism whereby the data passes from the keyboard to the hard drive before showing in the monitor. Even if the databases shut down unexpectedly without warning, the data can be recovered.

New features in the SQL 2005 release provide enhanced mechanisms to manage data protection and rapid restoration. Mirrored backups allow you to create multiple copies of the backup file. These backups have identical content, so you can always mix the files in case one of the sets becomes corrupt.

Copy only backups enable you to make a copy of the database without interrupting the sequence of other backup files. This copy can be used to restore your database, instead of going through the full backup and translation log. You can also save time by using partial backups for all filegroups, except those marked as read-only.

MySQL falls short in recovery with its default MyISAM mechanism. The UPS assumes uninterrupted data, and in the event of an unexpected shutdown your data can be lost and the data store corrupted.
09/26/2008 12:51 Rechocto#28
wow they made a few SIMPLE additions to MySql, and they have to write all that trying to hype it up?