0

I'm trying to connect my Emulator app to a MySQL Database i created. It works if i access the database using an app/website from the LAPTOP. But it fails to recognize the database if i am accessing it using the EMULATOR, my guess it that it treats the Windows Emulator as an external device. I already added Port 3306 (Default MySQL Port) in the firewall exceptions, freed database privileges, and used the IP Address of the Laptop and Emulator, and still, i get the "Cannot connect to any of the specified MySQL Hosts".

DB Connection Code:

private async void dbConnectAsync()
    {
        string con = "server=192.168.8.100:3306;database=donation;uid=root;password=;SslMode=none;CharSet=utf8";
        MySqlConnectionStringBuilder sb = new MySqlConnectionStringBuilder(con);
        using (conn = new MySqlConnection(con))
            try
            {
                conn.Open();
            }
            catch (Exception err)
            {
                var dialog2 = new MessageDialog(err.Message);
                dialog2.Title = "Connection Error";
                dialog2.Commands.Add(new UICommand { Label = "Ok", Id = 0 });
                var res = await dialog2.ShowAsync();
            }
    }
3

1 Answer 1

0

Fixed using host PC's IP Address which is 192.168.8.100 and removed the :3306 fixed the issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.