Link to home
Start Free TrialLog in
Avatar of Don VonderBurg
Don VonderBurgFlag for United States of America

asked on

The query builder failed. Unable to connect to any of the specified MySQL hosts.

I have a large Windows desktop project written in C# using Visual Studio 2013 Pro. There are 8 datasets that connect remotely to a MySQL database. This code has worked for years. The connection string in the project string settings will connect just fine. When I open a dataset in designer view and attempt to add a new table clicking the "Query builder..." button it produces the error "The query builder failed. Unable to connect to any of the specified MySQL hosts." (attached screen shot). If I attempt to enter a query manually at the end of the wizard there is an error "Object reference not set to an instance of an object" for a simple select statement.  

The only changes are MySql.Data updated from  6.7.4 to 6.10.4 via NuGet and .NET Framework went from 4 to 4.5.2 (to match the dependency of the new MySQL upgrade). I have checked the Machine.config file and the proper versions updated properly.

Another issue is after the upgrade I lost the designer.cs files to the datasets. I attempted to run the Custom Tool on each of the .xsd files for the datasets and get "the custom tool 'MSDataSetGenerator' failed. Failed to generate code. Object reference not set to an instance of an object." I think the two issues are related. I am pressed to get this fixed for release.

User generated imageUser generated imageUser generated imageUser generated image
Avatar of Don VonderBurg
Don VonderBurg
Flag of United States of America image

ASKER

Update: I can connect with MySQL Workbench to the remote MySQL server and perform all actions. So I know all my ports and connections are in tune.
Update: I Started a brand new project and used NuGet to get MySQL.Data. Same error when attempting to create a table adapter in a new dataset.
Avatar of John Tsioumpris
I will take a wild guess....do you try to connect to a remote mySQL instance (not locally on your machine) and you are using user 'root'?
If so recently the 'root' has being denied of remote connectivity and it needs some trickery to bypass it....so try with another user that has all the necessary GRANT's and report back...
John - Thanks for the input. I am not using 'root' in my connection string I have a different user added with the settings I need. The desktop application is still working in the field with our customers for the version they have installed. The issue is with Visual Studio 2013 solution/project. I needed to add another table adapter for a feature request to our software and my Nuget stated MySQL had updates so I performed them. I updated and now I cannot get any of the datasets that use MySQL to allow me to add another table adapter.
I have been reading this site https://dev.mysql.com/doc/visual-studio/en/visual-studio-install.html for more information. I have rolled back to MySQL For VisualStudio 1.2.7 and .NET Connector 6.9.10. I am still having the same issues. I think I need to roll back further now that I have figured out that NuGet can install picked version.
ASKER CERTIFIED SOLUTION
Avatar of Don VonderBurg
Don VonderBurg
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of A T
A T

Thanks to Don VonderBurg above for the fix! I had the exact same issue. However, the problem is with MySQL Connector/Net 6.9.10 ONLY. You do not have to revert to older version of MySQL for Visual Studio. Once you roll back MySQL Connector/Net from 6.9.10 to 6.8.8 (immediate previous release), the problem went away. Cannot believe MySQL team released MySQL Connector/Net 6.9.10 with such a bug.
Found the answer.