I'm developing a Visual C# (VS 2005) application which connects to a remote MySQL 5 database.
I'm using MySql.Data to connect to it but it's giving me some wierd issues.
It works ok if i try to connect to localhost but when i try to connect to a remote server i get an exception saying "Connection must be valid and open".
There are two wierd thing about this. The first one is that if i try to connect to another remote MySQL database (version 4.1) it works fine. At first i thought it would be a permission issue but i can connect remotely using Query Browser. The other wierd thing is that if i use another connection driver (MySQLDriverCS) it works fine.
(Can't use this driver because that would mean rewriting lots and lots of code).
Does anyone knows what could be wrong?
Just in case i post a sample of my code.
string constring = "Data Source=remoteserver.com;Password=user_pwd;User Id=remote_user;Database=testdb1;Port=21"; //MySQL server is running under port 21. This is working Ok. MySqlConnection conn = new MySqlConnection(constring); conn.Open(); conn.Close();
The exception happens at conn.Open()
Any help would be greately appreciated.
Thanks.