Page 1 of 1

Cant connect to MySQL server on '{0}' ({1})

Posted: Sun 27 Jun 2010 16:34
by ifarn
dotConnect for MySQL Mobile Standard 5.80.140 Release date 21-May-2010

wireless device: Windows CE 5.0 (.NET Compact Framework)

visual studio 2008,

error: Cant connect to MySQL server on '{0}' ({1})


using Devart.Data.MySql;

private Devart.Data.MySql.MySqlConnection mySqlConnection;
private Devart.Data.MySql.MySqlCommand mySqlCommand;

private void button1_Click(object sender, EventArgs e)
mySqlConnection = new Devart.Data.MySql.MySqlConnection();
mySqlCommand = new Devart.Data.MySql.MySqlCommand();
mySqlConnection.ConnectionString = "User Id=root;Database=mysql;Host=;";
mySqlCommand.Connection = mySqlConnection;
mySqlCommand.Connection.Open(); <-- error

1. Devart.Data.MySql.dll is added in References
2. I have try to ping ip from wireless device, there is no problem
3. I have try to change the ip to 'localhost' and server name 'unet1', but same error
4. i'm not run it on emulator, i always compile it and run on wireless device

so ..
may i know why the following error happen?
Cant connect to MySQL server on '{0}' ({1})

or what else information your need to know?


Posted: Mon 28 Jun 2010 10:44
by ifarn

anyone can help .. !?

Posted: Tue 29 Jun 2010 11:25
by Shalex
1. Is there any inner exception (MySqlException.InnerException)? 'Cant connect to MySQL server...' is a high level exception. Probably, the inner exception will allow to determine the original problem.
2. Please post here your call stack (MySqlException.StackTrace).
3. Try setting the password connection string parameter.

Here are the general recommendations:

Make sure the MySQL Server service is launched, and your database can be accessed from another tool.

If you set 'localhost' or '' as a sever name, your application deployed to a mobile device will try to connect to itself (not to your desktop machine). So please set the IP address of your machine with the MySQL database in the connection string.

Please note, some synchronization tool (e.g., Microsoft ActiveSync) should be used if you work with some emulator (e.g., USA Windows mobile 5.0 Pocket PC R2 Emulator) or with your device. Before deployment make cradle to the emulator you want to use via Device Emulator Manager (the Tools menu in Visual Studio). After cradle the ActiveSync icon in the tray should become green (indication that synchronization is successful).

Posted: Tue 29 Jun 2010 17:22
by ifarn
i'm newbie in c# ..

thanks your hint about MySqlException ..

now the problem is solved

thanks a lot ..