• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2117
  • Last Modified:

MySQL Connector 6.9.5 Failed to open a connection to the database

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
Don VonderBurg
Asked:
Don VonderBurg
  • 5
  • 5
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
Make sure the username and password that you are using has the privileges that you need.
0
 
Don VonderBurgPresident/CEOAuthor Commented:
Dave - thank you for the quick response. I gave the user full access and still get the error.
0
 
Dave BaldwinFixer of ProblemsCommented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Don VonderBurgPresident/CEOAuthor Commented:
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
 
Dave BaldwinFixer of ProblemsCommented:
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
 
Don VonderBurgPresident/CEOAuthor Commented:
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
 
Dave BaldwinFixer of ProblemsCommented:
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
 
Don VonderBurgPresident/CEOAuthor Commented:
Good idea. But they are the same and look good.
0
 
Don VonderBurgPresident/CEOAuthor Commented:
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
 
Dave BaldwinFixer of ProblemsCommented:
Please click on "Request Attention" above to get some other to look at your question.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now