Solved

MySQL Connector 6.9.5 Failed to open a connection to the database

Posted on 2015-01-01
10
1,813 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:Don VonderBurg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:Don VonderBurg
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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
LVL 1

Author Comment

by:Don VonderBurg
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
 
LVL 1

Author Comment

by:Don VonderBurg
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:Don VonderBurg
ID: 40529363
Good idea. But they are the same and look good.
0
 
LVL 1

Author Comment

by:Don VonderBurg
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

705 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