Newbie says hi - server/MySQL woes

9 replies [Last post]
Posts: 11
CP: 0

So, I checked out the latest revision from SVN and have built the solution successfully in debug mode. However, when I start the DemoGame.Server, it crashes with an exception on Server.cs line 93 ( _world = new World(this); )

The error details:

System.TypeInitializationException was unhandled
  Message=Typeinitialiseringen for DemoGame.Server.World forårsaket et unntak.
  Source=DemoGame.Server
  TypeName=DemoGame.Server.World
  StackTrace:
       ved DemoGame.Server.World..ctor(Server parent)
       ved DemoGame.Server.Server..ctor() i C:\SVN\NetGore\DemoGame.Server\Server.cs:linje 93
       ved DemoGame.Server.UI.frmMain.ServerThread() i C:\SVN\NetGore\DemoGame.Server\UI\WinForms\frmMain.cs:linje 353
       ved System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       ved System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       ved System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.TypeInitializationException
       Message=Typeinitialiseringen for DemoGame.Server.ItemTemplateManager forårsaket et unntak.
       Source=DemoGame.Server
       TypeName=DemoGame.Server.ItemTemplateManager
       StackTrace:
            ved DemoGame.Server.ItemTemplateManager.get_Instance()
            ved DemoGame.Server.World..cctor() i C:\SVN\NetGore\DemoGame.Server\World\World.cs:linje 22
       InnerException: System.IndexOutOfRangeException
            Message=Could not find specified column in results
            Source=MySql.Data
            StackTrace:
                 ved MySql.Data.MySqlClient.ResultSet.GetOrdinal(String name)
                 ved MySql.Data.MySqlClient.MySqlDataReader.GetOrdinal(String name)
                 ved NetGore.Db.DataReaderContainer.GetOrdinal(String name) i C:\SVN\NetGore\NetGore.Db\DataReaderContainer.cs:linje 619
                 ved DemoGame.Server.DbObjs.ItemTemplateTableDbExtensions.ReadValues(ItemTemplateTable source, IDataReader dataReader) i C:\SVN\NetGore\DemoGame.Server\DbObjs\DbExtensions\ItemTemplateTableDbExtensions.cs:linje 110
                 ved DemoGame.Server.Queries.SelectItemTemplateQuery.Execute(ItemTemplateID id) i C:\SVN\NetGore\DemoGame.Server\Queries\Item\Template\SelectItemTemplateQuery.cs:linje 33
                 ved DemoGame.Server.ItemTemplateManager.LoadItem(ItemTemplateID id) i C:\SVN\NetGore\DemoGame.Server\World\Map\Entities\Items\ItemTemplateManager.cs:linje 114
                 ved NetGore.Db.DbTableDataManager`2.LoadAll() i C:\SVN\NetGore\NetGore.Db\DbTableDataManager\DbTableDataManager.cs:linje 115
                 ved NetGore.Db.DbTableDataManager`2..ctor(IDbController dbController) i C:\SVN\NetGore\NetGore.Db\DbTableDataManager\DbTableDataManager.cs:linje 38
                 ved DemoGame.Server.ItemTemplateManager..ctor(IDbController dbController) i C:\SVN\NetGore\DemoGame.Server\World\Map\Entities\Items\ItemTemplateManager.cs:linje 32
                 ved DemoGame.Server.ItemTemplateManager..cctor() i C:\SVN\NetGore\DemoGame.Server\World\Map\Entities\Items\ItemTemplateManager.cs:linje 25
            InnerException: 

I had some issues while trying to import the SQL file too (insufficient privileges, need SUPER blahblah) - how many tables is the database supposed to be? I wanted to use my "online" MySQL database rather than a local one. However, MYSQL posts a truckload of gibberish and an error message when trying to import..

#1227 - Access denied; you need the SUPER privilege for this operation

Of course it doesn't mention which of the 1500 lines is responsible.

Is there another method I can use to get the database up without needing privileges second only to God? This project seems fairly interesting, but if I can't even get it up and running on a regular MySQL host...

Thanks in advance.

Posts: 11
CP: 0

And unless any of you speaks Norwegian, I should probably add that most of the exceptions are just whining about the type initialization causing an exception (O RLY??)

Posts: 1647
CP: 26119

Why don't you just run the MySQL server locally? Then you can just use root and not have to worry about privileges for the time being. You won't want to be running the server and database on separate machines (unless in a LAN) anyways since the latency of those two communicating will end up killing performance.

Posts: 36
CP: 0

Are you using free hosting and trying to put the gamedatabase in to that? If so, most free hosting only allows 1-2 tables to be created in your database and so they are probably pushing your to purchase a higher grade account with them. As spodi said, use it on your machine locally to get the hang of it. I'm not sure there is a guide here, but on his vbgore website there is an extremely easy to understand guide to setting up mysql on your home PC - I refer people to this regularly

Posts: 11
CP: 0

Thanks for the replies, and no, it's not free hosting. Do you know what exactly requires the "SUPER privilege" in that file? Creating a bunch of tables should be doable.

I suppose I don't absolutely need remote SQL, I can use a local serv for the time being - just for testing.

Posts: 1647
CP: 26119

You can execute the query parts piece by piece instead of in batch. Not sure why you would need SUPER, though, and haven't heard of anyone having this problem before.

Posts: 11
CP: 0

Sigh, ok, database is running locally. When creating character, server fails on DbQueryReader.cs, line 121.

MySql.Data.MySqlClient.MySqlException was unhandled
  Message=FUNCTION robhol_netgore.CreateUserOnAccount does not exist
  Source=MySql.Data
  ErrorCode=-2147467259
  Number=1305
  StackTrace:
       ved MySql.Data.MySqlClient.MySqlStream.ReadPacket()
       ved MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId)
       ved MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int32& insertedId)
       ved MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId)
       ved MySql.Data.MySqlClient.MySqlDataReader.NextResult()
       ved MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
       ved MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       ved System.Data.Common.DbCommand.ExecuteReader()
       ved NetGore.Db.DbQueryReader`1.NetGore.Db.IDbQueryReader<T>.ExecuteReader(T item) i C:\SVN\NetGore\NetGore.Db\Query\DbQueryReader.cs:linje 121
       ved NetGore.Db.DbQueryReader`1.ExecuteReader(T item) i C:\SVN\NetGore\NetGore.Db\Query\DbQueryReader.cs:linje 91
       ved DemoGame.Server.Queries.CreateUserOnAccountQuery.TryExecute(String accountName, CharacterID characterID, String userName, String& errorMsg) i C:\SVN\NetGore\DemoGame.Server\Queries\Account\CreateUserOnAccountQuery.cs:linje 55
       ved DemoGame.Server.UserAccount.TryAddCharacter(IDbController dbController, String accountName, String characterName, CharacterID characterID, String& errorMsg) i C:\SVN\NetGore\DemoGame.Server\Account\UserAccount.cs:linje 312
       ved DemoGame.Server.UserAccount.TryAddCharacter(IDbController dbController, String accountName, String characterName, String& errorMsg) i C:\SVN\NetGore\DemoGame.Server\Account\UserAccount.cs:linje 291
       ved DemoGame.Server.Server.CreateAccountCharacter(IIPSocket conn, String name) i C:\SVN\NetGore\DemoGame.Server\Server.cs:linje 217
       ved DemoGame.Server.ServerPacketHandler.RecvCreateNewAccountCharacter(IIPSocket conn, BitStream r) i C:\SVN\NetGore\DemoGame.Server\Networking\ServerPacketHandler.cs:linje 358
       ved NetGore.Network.MessageProcessorManager.Process(IIPSocket socket, Byte[] data) i C:\SVN\NetGore\NetGore\Network\MessageProcessor\MessageProcessorManager.cs:linje 189
       ved NetGore.Network.MessageProcessorManager.Process(SocketReceiveData rec) i C:\SVN\NetGore\NetGore\Network\MessageProcessor\MessageProcessorManager.cs:linje 109
       ved NetGore.Network.MessageProcessorManager.Process(IEnumerable`1 recvData) i C:\SVN\NetGore\NetGore\Network\MessageProcessor\MessageProcessorManager.cs:linje 205
       ved DemoGame.Server.ServerPacketHandler.Process(IEnumerable`1 recvData) i C:\SVN\NetGore\DemoGame.Server\Networking\ServerPacketHandler.cs:linje 912
       ved DemoGame.Server.ServerSockets.Heartbeat() i C:\SVN\NetGore\DemoGame.Server\Networking\ServerSockets.cs:linje 45
       ved DemoGame.Server.Server.GameLoop() i C:\SVN\NetGore\DemoGame.Server\Server.cs:linje 308
       ved DemoGame.Server.Server.Start() i C:\SVN\NetGore\DemoGame.Server\Server.cs:linje 554
       ved DemoGame.Server.UI.frmMain.ServerThread() i C:\SVN\NetGore\DemoGame.Server\UI\WinForms\frmMain.cs:linje 358
       ved System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       ved System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       ved System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

What do I do?

Posts: 1647
CP: 26119

For some reason, you don't have the CreateUserOnAccount() function in the database. It should have been created when you imported the dump file.

Posts: 531
CP: 967

I've noticed this:

Sometimes the functions (particularly the views) don't get created, for the life of me i don't know why, and wy i've never reported it. I think it's because it randomly happens and i dont know how to recreate it.

There are 10 types of people in this world - Those who understand Binary and those who don't.

Posts: 1003
CP: 7799

When DF tried migrating the db to our webserver's db it asked fro SUPER as well.