Answered by:
MySQL connection on Windows CE 5.0

Question
-
I tried to make a connection between MySQL Server and Windows CE 5.0 with the following commands:
Imports MySQL.Data.MySqlClient
Private Sub frm_login_Load(Byval sender AS System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cnn_MySQL = New MySqlConnection
cnn_MySQL.ConnectionString = "server=xx.xxx.xxx.xx; port=3306; uid=****; pwd=****; database=mydatabase"
cnn_MySQL.Open()
End Sub
I got the message: "Unable to connect to any of the specified MySQL hosts."
Searching on the web i found the solution like enable the option skip-name-resolve on MySQL Server, but this dont work.
Thursday, July 18, 2013 11:21 PM
Answers
-
Group Policies only apply if you are trying to log into a database without a Username and Password in the connection string. Since it is working on a lot of other computer (you didn't say thjis originally) you either have something blocking the Port Number or there is some security issue (like a certificate is needed). Are the XP PCs all using the same MySQL Server or is the server installed on each XP PC?
The CE Net Library is slightly different from the XP version of the Net Library. Not all the Net functionality is incorporated into the CE version. I think this would cause a compile error. Have you check the log files on the My SQLServer?
Look at the Class "MySqlConnection". I think the error is being caused by functoin inside this class. You may be gettring an exception inside the code. I would put a break point on this line of code (select line and press F9) belowe and run the code from the beginning.
cnn_MySQL.Open()
Then step through the code using F11.
jdweng
- Proposed as answer by Damon Bu - MSFT Wednesday, July 31, 2013 5:37 AM
- Marked as answer by Franklin ChenMicrosoft employee Wednesday, July 31, 2013 5:42 AM
Friday, July 19, 2013 12:25 PM -
I found a similar error on th ewebpage below
Reading the webpage think you problem has to do with your DNS server. Talk to the MIS people who configure your DNS server. Not sure if the problem is on your end or the Server End of the connection. The Group Policies and the DNS Server issues are very similar and must be solved by the people who manage the network(s).
jdweng
- Edited by Joel Engineer Friday, July 19, 2013 1:56 PM typo
- Proposed as answer by Damon Bu - MSFT Wednesday, July 31, 2013 5:37 AM
- Marked as answer by Franklin ChenMicrosoft employee Wednesday, July 31, 2013 5:42 AM
Friday, July 19, 2013 1:55 PM
All replies
-
You have a simple problem that you either can't reach the IP address, a firewall is blocking the port number, you aren't using the correct credentials, or the database service isn't configured properly.
Here are some suggestion
1) Turn off any firewalls or unblock the port number3306
2) Use PING to make sure you can get to the IP address
3) Verify the daatabase service is running and coinfigured to listen to port 3306
4) Verify the username and account are correct in the database and in the windows user account. If you are trying to reach the database from a remote PC make sure the Group Policies are configured properly.
jdweng
- Proposed as answer by Damon Bu - MSFT Wednesday, July 31, 2013 5:36 AM
Friday, July 19, 2013 2:15 AM -
I turn off firewall on the server (Windows Server 2012) and cannot get connection between MySQL and Windows CE 5.0.
At the device running Windows CE 5.0 (Honeywell Dolphin 7600) I can ping the server with no problem. By IP or by computer name, all works.
The MySQL Server is configured to listen on port 3306 by default, I never change. In fact there is around 100 machines running windows XP / 7 that can connect with no problem on the MySQL Server using the same VB.NET code.
The username / password / databasename about MySQL are correct.
About the Group Policies, can you explain a little more?
Friday, July 19, 2013 10:56 AM -
Group Policies only apply if you are trying to log into a database without a Username and Password in the connection string. Since it is working on a lot of other computer (you didn't say thjis originally) you either have something blocking the Port Number or there is some security issue (like a certificate is needed). Are the XP PCs all using the same MySQL Server or is the server installed on each XP PC?
The CE Net Library is slightly different from the XP version of the Net Library. Not all the Net functionality is incorporated into the CE version. I think this would cause a compile error. Have you check the log files on the My SQLServer?
Look at the Class "MySqlConnection". I think the error is being caused by functoin inside this class. You may be gettring an exception inside the code. I would put a break point on this line of code (select line and press F9) belowe and run the code from the beginning.
cnn_MySQL.Open()
Then step through the code using F11.
jdweng
- Proposed as answer by Damon Bu - MSFT Wednesday, July 31, 2013 5:37 AM
- Marked as answer by Franklin ChenMicrosoft employee Wednesday, July 31, 2013 5:42 AM
Friday, July 19, 2013 12:25 PM -
All other PCs use the same MySQL Server and I cannot found any errors on the MySQL log. (I'll try a little more harder to find this info on the MySQL Server...)
I did what you say about the break point and step by step on the code and after try to execute cnn_MySQL.Open() i got this:
Unable to connect to any of the specified MySQL hosts.
MySQL.Data.MySqlClient.NativeDriver.Open()
MySQL.Data.MySqlClient.Driver.Open()
MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
MySql.Data.MySqlClient.MySqlPool.GetConnection()
MySql.Data.MySqlClient.MySqlConnection.Open()
Scanne_System.frm_Login.frm_Login_Load(Object sender, EventArgs e)
System.Windows.Forms.Form.OnLoad(EventArgs e)
System.Windows.Forms.Form._SetVisibleNotify(Boolean fVis)
System.Windows.Forms.Control.set_Visible(Boolean value)
System.Windows.Forms.Application.Run(Form fm)
Scanne_System.frm_Login.Main()
Friday, July 19, 2013 1:34 PM -
I found a similar error on th ewebpage below
Reading the webpage think you problem has to do with your DNS server. Talk to the MIS people who configure your DNS server. Not sure if the problem is on your end or the Server End of the connection. The Group Policies and the DNS Server issues are very similar and must be solved by the people who manage the network(s).
jdweng
- Edited by Joel Engineer Friday, July 19, 2013 1:56 PM typo
- Proposed as answer by Damon Bu - MSFT Wednesday, July 31, 2013 5:37 AM
- Marked as answer by Franklin ChenMicrosoft employee Wednesday, July 31, 2013 5:42 AM
Friday, July 19, 2013 1:55 PM