I wrote an application with .net compact framework 3.5 (Visual Studio 2008) and MySql Database.
The version of connector/net dll I used was 6.5.4 (MySql.Data.CF.dll for compact framework). When connect to External Server IP, I got this error: "Error No. 1042: Unable to connect to any of the specified MySQL hosts".
Just before I used internal IP in my workplace (localhost), it works fine. The connection to internal IP of DB server was made ok.
The problem occurred when I install MySQL DB on an external server (not in my workplace) and use my c# compact framework code to make connect to, it raises that error.
Here is my code:
using MySql.Data;
using MySql.Data.MySqlClient;
...
string MyConString = "server = <external IP of DB Server>; port = 3306; uid = mtri; pwd = abc123; database = mydb;";
MySqlConnection conn = new MySqlConnection(MyConString);
try
{
conn.Open();
}
catch (MySqlException ex)
{
MessageBox.Show("Error" + ex.Number.ToString() + " Message: " + ex.Message);
}
When use internal IP (localhost), it connects OK, but when I use an external IP, it raise error, I had used MySQL Query Browser to connect to that DB and it connect OK. Any tool on desktop can connect to that external DB ok, but in my windows mobile device app isnot.
Anyone can help me?
The version of connector/net dll I used was 6.5.4 (MySql.Data.CF.dll for compact framework). When connect to External Server IP, I got this error: "Error No. 1042: Unable to connect to any of the specified MySQL hosts".
Just before I used internal IP in my workplace (localhost), it works fine. The connection to internal IP of DB server was made ok.
The problem occurred when I install MySQL DB on an external server (not in my workplace) and use my c# compact framework code to make connect to, it raises that error.
Here is my code:
using MySql.Data;
using MySql.Data.MySqlClient;
...
string MyConString = "server = <external IP of DB Server>; port = 3306; uid = mtri; pwd = abc123; database = mydb;";
MySqlConnection conn = new MySqlConnection(MyConString);
try
{
conn.Open();
}
catch (MySqlException ex)
{
MessageBox.Show("Error" + ex.Number.ToString() + " Message: " + ex.Message);
}
When use internal IP (localhost), it connects OK, but when I use an external IP, it raise error, I had used MySQL Query Browser to connect to that DB and it connect OK. Any tool on desktop can connect to that external DB ok, but in my windows mobile device app isnot.
Anyone can help me?