Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

SQL Error - Unable to connect from outside

Newbie Spellweaver
Joined
May 17, 2014
Messages
10
Reaction score
1
I believe that it is a simple fix but am unsure of what to do. I can connect to the Luna server locally just fine, but however trying to connect from outside poses a problem. I checked the DistrubuteServer and found that when trying to connect from the outside it gives a SQL error of unable to insert duplicate key in PK_LoginTable. Anyone have any idea on how to solve this? Thanks for all the help.
 
I play it straight up, yo
Joined
May 19, 2012
Messages
931
Reaction score
121
I believe that it is a simple fix but am unsure of what to do. I can connect to the Luna server locally just fine, but however trying to connect from outside poses a problem. I checked the DistrubuteServer and found that when trying to connect from the outside it gives a SQL error of unable to insert duplicate key in PK_LoginTable. Anyone have any idea on how to solve this? Thanks for all the help.

Sounds like a problem with the primary key. I suggest looking at that table and how its key is setup. If your unsure what a primary key is then I suggest googling it or looking here:
 
Newbie Spellweaver
Joined
May 17, 2014
Messages
10
Reaction score
1
Sounds like a problem with the primary key. I suggest looking at that table and how its key is setup. If your unsure what a primary key is then I suggest googling it or looking here:

It has to do with the primary key + constraint if I am correct I believe, I'll post a screenshot of it if that will help clarify anything.

5m1df39 - SQL Error - Unable to connect from outside - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Junior Spellweaver
Joined
Jun 5, 2009
Messages
144
Reaction score
19
Yes, that is about the primary key. I'm not sure what's the primary of the logintable table but its for sure the server is trying to insert another data that has the same primary key in the table. It is better to check that if the account has logged out, it should also be removed in the logintable. If the servers has crashed or closed down, once they are restarted, the logintable must be empty. If the user tries to login and his info is still in the logintable, then add a query to update its info or just delete it and re-add the info but i think its better to just update it. And to be more safe, there should be a checker if the player has logged out safely (not closing immediately the client, but do the normal way of logging out) but there are instances that the player was disconnected from the server due to connection issues. If you're able to check these types of scenarios, then immediately disconnect the player. Or just ignore the check and just find out if the player is still in game when they try to login. Then, safely disconnect the account from the server(there might be a lot of tables related to the logintable. Find a way on how to disconnect the players maybe through a stored procedure to safely remove them from the game, then just execute that stored procedure when they try to login, only if their info is still in the logintable). The easiest way though is just to restart your distribute server everytime you encounter this error but its not recommended. Try checking the stored procedure that has something to do with the logintable and do the necessary fix. This might be a lot but these are just scenarios that might trigger the primary key constraint error in the logintable.
 
Last edited:
Newbie Spellweaver
Joined
May 17, 2014
Messages
10
Reaction score
1
Yes, that is about the primary key. I'm not sure what's the primary of the logintable table but its for sure the server is trying to insert another data that has the same primary key in the table. It is better to check that if the account has logged out, it should also be removed in the logintable....

I am the only user that has access to the server. But for some reason It has never let me login in from another location. Even after playing around with the logintable and primary key it still does not allow access. Otherwise it has been a good learning experience with coding and setting up a game server until I got stuck on this. Changing the (Clustered) Primary key in indexes slightly somewhat changes it but causes the client to think the client version has changed.
 
Back
Top