SignUp Unexpected database Error

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Kor
Posts: 3
Joined: 29 Jan 2020, 16:53

SignUp Unexpected database Error

Postby Kor » 30 Jan 2020, 05:15

Hi,i have the Signup unexpected database Error in my log of unity.Could you please help me,please? I gave the name of table "users" using postgresql,add extension in smartfox and choose the main class SignUp. Here is my server code consists of two classes from different packages :

Code: Select all

package Login;

import com.smartfoxserver.v2.components.login.LoginAssistantComponent;
import com.smartfoxserver.v2.extensions.SFSExtension;
/**
 *
 * @author User
 */
public class ZoneExtension extends SFSExtension {
 
    private LoginAssistantComponent lac;

   @Override
   public void init()
   {
   lac = new LoginAssistantComponent(this);
        lac.getConfig().loginTable = "users";
   lac.getConfig().userNameField = "username";
        lac.getConfig().passwordField = "password";
        lac.getConfig().nickNameField = "email";
   }
   
   @Override
   public void destroy()
   {
       super.destroy();
       lac.destroy();
   }
}
package SignUp;

import com.smartfoxserver.v2.components.signup.SignUpAssistantComponent;
import com.smartfoxserver.v2.extensions.SFSExtension;

/**
 *
 * @author User
 */
public class ZoneExtension extends SFSExtension {
    private SignUpAssistantComponent suac;
    @Override
    public void init()
    {
        suac=new SignUpAssistantComponent();
    addRequestHandler(SignUpAssistantComponent.COMMAND_PREFIX,suac);
    }
}

Here is my client code:

Code: Select all

using UnityEngine;
using Sfs2X;
using Sfs2X.Core;
using Sfs2X.Entities.Data;
using Sfs2X.Requests;
using Sfs2X.Entities;


public class SignUp : MonoBehaviour
{

    public string Host = "127.0.0.1";
    public int TcpPort = 9933;
    public string Zone = "game";
    public string UserName = "";
    public string Password = "";
    public string Email = "";
    SmartFox sfs;
    string CMD_Signup = "$SignUp.Submit";

   public void Start()
    {
        sfs = new SmartFox();
        sfs.ThreadSafeMode = true;

        sfs.AddEventListener(SFSEvent.CONNECTION, OnConnection);
        sfs.AddEventListener(SFSEvent.LOGIN, OnLogin);
        sfs.AddEventListener(SFSEvent.LOGIN_ERROR, OnLoginError);
        sfs.AddEventListener(SFSEvent.EXTENSION_RESPONSE, OnExtensionResponse);
        sfs.Connect(Host, TcpPort);
    }
  public void OnConnection(BaseEvent evt)
    {
        if ((bool)evt.Params["success"])
        {
            Debug.Log("Succesfully Connected");
            //login in to Zone
            sfs.Send(new LoginRequest("", "", Zone));

        }
        else
        {
            Debug.Log("Connection failed");
        }
    }
    public void OnLogin(BaseEvent evt)
    {
        User user = (User)evt.Params["user"];
        Debug.Log("User: " + user.Name);
        ISFSObject objOut = new SFSObject();
        objOut.PutUtfString("username", UserName);
        objOut.PutUtfString("password", Password);
        objOut.PutUtfString("email", Email);
        sfs.Send(new ExtensionRequest(CMD_Signup, objOut));
    }
    void OnLoginError(BaseEvent evt)
    {
        Debug.Log("Login error: (" + evt.Params["errorCode"] + "): " + evt.Params["errorMessage"]);
    }

 
    public void OnExtensionResponse(BaseEvent evt)
        {
       
            string cmd = (string)evt.Params["cmd"];
            ISFSObject objIn = (SFSObject)evt.Params["params"];

            if (cmd == CMD_Signup)
            {
                if (objIn.ContainsKey("errorMessage"))
                {
                    Debug.Log("Signup Error: " + objIn.GetUtfString("errorMessage"));
                }
                else if (objIn.ContainsKey("success"))
                {
                    Debug.Log("Signup Successful");
                }
            }
        }

   public void Update()
    {
        if (sfs != null)
        {
            sfs.ProcessEvents();
        }
    }

    public void OnApplicationQuit()
    {
        if (sfs.IsConnected)
        {
            sfs.Disconnect();
        }
    }
}
User avatar
Lapo
Site Admin
Posts: 21288
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SignUp Unexpected database Error

Postby Lapo » 30 Jan 2020, 09:42

Please show us the stack trace of the error.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 12 guests