Solved

MySQL Connector 6.9.5 Failed to open a connection to the database

Posted on 2015-01-01
10
1,489 Views
Last Modified: 2015-01-08
I am using Visual Studio 2013. I have a vb.net desktop application project. I add a dataset to the project and make a new connection to a hosted MySQL database. The connection is successful. I even see a table list int he drop down. Then when I attempt to add a table I get the following error:

Failed to open a connection to the database

"Cannot obtain provider factory for data provider named
'MySql.Data.MySqlClient'."

Check the connection and try again.

I have added MySQL.data to the project resources and made sure the "Copy Local" is set to true.

My GACUTIL /l has the following MySQL references:


MySql.Data, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL
  MySql.Data.CF, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL
  MySql.Data.Entity, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL
  MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL

My machine.config in the v4.0.30319 folder has the following entry:

<DbProviderFactories>
      <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
      <add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".NET Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=4.5.2.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" />
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>

What else can I check or do?
Untitled-picture.png
0
Comment
Question by:dvonderburg
  • 5
  • 5
10 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40526981
Make sure the username and password that you are using has the privileges that you need.
0
 
LVL 1

Author Comment

by:dvonderburg
ID: 40526995
Dave - thank you for the quick response. I gave the user full access and still get the error.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40527024
MySQL has it's own privilege tables with username, password, and source.  This is independent of any Windows authentication methods.  You need to check the MySQL privileges.  MySQL Always requires a MySQL username and password for access.  And MySQL privileges can be quite detailed.  More info here: http://dev.mysql.com/doc/refman/5.5/en/privileges-provided.html
0
 
LVL 1

Author Comment

by:dvonderburg
ID: 40527178
Dave - those are the privileges I changed. I used the control panel of my hosting vendor to make the user have full access to the database I am attempting to create a table adapter. I can connect and I can see the schema available for the user. I just cannot create the actual table adapter.

Capture3.PNG
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40527195
That looks like a web interface running on the server which can have different privileges.  Remember that MySQL users include the source or IP address of the connection.  Can you use MySQL Workbench on your computer to 'create' that table using the same credentials as your program?  http://www.mysql.com/products/workbench/
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 1

Author Comment

by:dvonderburg
ID: 40527883
Dave - now I see where we have miss communication. I am not trying to create a table on the MySQL server. I am attempting to create a "table adapter" in the Visual Studio 2013 application project in the dataset.xsd. The process is failing when a new adapter is attempted to be added to the dataset. See attached screen shots of steps.

With MySQL Workbench I can read and write to the table I need to connect to using the same user.
Step1.PNG
Step2.PNG
Step3.PNG
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40528137
In Step2.PNG, I would click on 'Yes...' to see what it thinks your connection string should be.  Then you can compare it to the one you are using.
0
 
LVL 1

Author Comment

by:dvonderburg
ID: 40529363
Good idea. But they are the same and look good.
0
 
LVL 1

Author Comment

by:dvonderburg
ID: 40529852
I decided to uninstall VS2013 and all components. I started from scratch just installing MySQL for VS and the Connector 6.9.5, in that order. I started a new project and added a dataset. I added a new connection and it connected just fine. But when I attempted to add a new table adapter I am getting the same results. There must be a solution for this. In my old VS2010 I can create table adapters all day long using .Net connector 6.3.9. I really need to get past this hurdle it is putting me WAY behind. Any experts out there?
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40529861
Please click on "Request Attention" above to get some other to look at your question.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Creating and Managing Databases with phpMyAdmin in cPanel.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now