Solved

MySQL Connector 6.9.5 Failed to open a connection to the database

Posted on 2015-01-01
10
1,397 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 82

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 82

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 82

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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 82

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 82

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

22 Experts available now in Live!

Get 1:1 Help Now