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

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

Postby ifarn » Sun 27 Jun 2010 16:34

dotConnect for MySQL Mobile Standard 5.80.140 Release date 21-May-2010

wireless device: Windows CE 5.0 (.NET Compact Framework)
http://www.opticon.com/H15.aspx

visual studio 2008, c#.net

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



coding:


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=192.168.1.22;";
mySqlCommand.Connection = mySqlConnection;
mySqlCommand.Connection.Open(); <-- error
..
..
}


1. Devart.Data.MySql.dll is added in References
2. I have try to ping ip 192.168.1.22 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?



thanks.
ifarn
 
Posts: 3
Joined: Sun 27 Jun 2010 14:37

Postby ifarn » Mon 28 Jun 2010 10:44

yoyo

anyone can help .. !?
ifarn
 
Posts: 3
Joined: Sun 27 Jun 2010 14:37

Postby Shalex » Tue 29 Jun 2010 11:25

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 '127.0.0.1' 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).
Shalex
Devart Team
 
Posts: 7377
Joined: Thu 14 Aug 2008 12:44

Postby ifarn » Tue 29 Jun 2010 17:22

i'm newbie in c# ..

thanks your hint about MySqlException ..

now the problem is solved

thanks a lot ..
ifarn
 
Posts: 3
Joined: Sun 27 Jun 2010 14:37


Return to dotConnect for MySQL