Bug #70676 Unable to connect to local MySQL database from Visual Studio 2012
Submitted: 21 Oct 2013 16:31 Modified: 21 Feb 2015 0:53
Reporter: Priyanga Gunarathne Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Visual Studio Integration Severity:S2 (Serious)
Version:6.7.4.0 OS:Windows (Windows 7 64 bit)
Assigned to: Assigned Account CPU Architecture:Any

[21 Oct 2013 16:31] Priyanga Gunarathne
Description:
I see a similar issue at Bug #69951, but I cannot resolve mine according to the given rectifications, so appreciate your help.

I have Windows 7 64 bit O/S, Visual Studio 2012 installed prior to MySQL, Latest full installation (5.6.14) of MySQL including MySQL for Visual Studio 1.0.2 and MySQL Connector Net 6.7.4.

I have a local MySQL Database up and running and which works perfectly with MySQL Workbench.

Using the Server Explorer on the Visual Studio, I try to connect to the databases at localhost but it does not list any databases and says that "Unable to retrieve the list of databases". I am 100% sure that I give the right credentials.

When I specify the sample test dbs like test, sakila and click the "Test Connection" button, it displays the error message "The system detected an invalid pointer address in attempting to use a pointer argument in a call".

I looked up the issue and find that this is related to IPV6 & IPV4 conflict and there were associated bugs fixed for this in NET connector version 6.7.0.0, but not sure whether it is the same problem.

Also I find that there is no folder for \MySQL\MySQL for Visual Studio 1.0.2\Assemblies\v4.5 with the correct MySQL.Data.dll.

The  MySQL.Data.dll at the \MySQL\MySQL Connector Net 6.7.4\Assemblies\v4.5  still has the version 4.0.

Re installing Net connector and MySQL for Visual Studio did not help.
Deeply appreciate your help. 

How to repeat:
Install Visual Studio 2012 on Windows 7 64 bit OS
Install the full version of MySQL using MySQL installer 5.6.14
Open Visual Studio 2012 and create a new project
Add the MySQL.Data.dll found in \MySQL\MySQL for Visual Studio 1.0.2\Assemblies\v4.0
Open Server Explorer
Choose MySQL Database as the data source and give right credentials
Click Test Connection button. 
Error message "The system detected an invalid pointer address in attempting to use a pointer argument in a call" will be displayed.
Clicking on the Database drop down will display the message "Unable to retrieve the list of databases"
[27 Nov 2013 21:06] Gabriela Martinez Sanchez
Hi Priyanga,

This problem happens due to a bad registration of the Database provider on the machine.config of your system. Could you please verify if your file has the correct MySQL provider?

To do that please follow these steps:
1 - Open your machine.config file on any text editor tool. You can find this file on the path:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config

2 - Look for the <DbProviderFactories> section 
It should contain the following line:
    <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.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

3 Save it.

If it's possible you can send it to us and we'll do the changes for you.

Thanks in advance,
[28 Dec 2013 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[20 Jan 2014 22:41] Risam Al banjumasy
I have error like this on my System too.

Detail of my system:
Windows 7 32 Bit.
Visual Studio 2012 with update 4
MySQL Connector Net 6.7.4 installed via MySQL Installer
MySQL Server 5.6 Community
Using Basic language environment.

when try to connect to MySQL server, get error "The System detect an invalid pointer address in attempting to use a pointer argument in a call".

I have been disable ipv6 supported on my system, but still got this error.
I have no idea to solve it.
[20 Jan 2014 22:44] Risam Al banjumasy
MySQL-Connector-net-error-poiter

Attachment: error-mysql-vs2012.jpg (image/jpeg, text), 143.64 KiB.

[4 Mar 2014 14:40] MySQL Verification Team
Please try instruction done by [27 Nov 2013 21:06] Gabriela Martinez Sanchez . Thanks.
[5 Apr 2014 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[8 Oct 2014 1:38] Mark Dennis Furton
this is the error

Attachment: error.JPG (image/jpeg, text), 134.19 KiB.

[8 Oct 2014 1:42] Mark Dennis Furton
Hi..I also got the same error "The system detected an invalid pointer address in attempting to use a pointer argument in a call"

I  have a Visual Studio project that automatically connects to my mysql database when run. My project suppose to connect to database and display the data on my data grid when opened or executed. The connection was working before, but since yesterday I started getting issue. 

MySql workbench version is 6.2.2
Windows Visual Studio 2013
OS is Windows 8

any advice or solution is appreciated.. Thanks
[19 Oct 2014 10:47] SDJ GZB
Hi,

I am also facing same problem. This thread is quite old, but still relevant.
The problem is listed but no solution at all. 
Would not it be great to publish the solution here itself so that other people can attempt to fix it at their end instantly.

Priyanka, and Gabriela Martinez Sanchez,
If you are aware of the solution please post it here or let me know if I need to send copy of my config file for your perusal.

Thanks,
SDJ
[10 Nov 2014 1:47] Mark Dennis Furton
Hi, 
I'm still unable to resolve this issue.
Please inform me if you need my machine.config. I am using Windows Visual Studio Ultimate 2013.

SDJ, were you able to resolve the issue?..can you share it to me.

Thanks,
[21 Jan 2015 0:53] Francisco Alberto Tirado Zavala
Hello Mark Denis and SDJ GZB.

Please can you provide information about the version of the products that you are using as well as if you update any product recently?

I did some tests using MySQL Installer 1.4.3 (named as MySQL Installer 5.6.22 in the download page) which install:
- MySQL for VS 1.2.3
- Connector/Net 6.9.5
- MySQL Server 5.6.22
- MySQL Workbench 6.2.4

I did tests on Windows 7 64x (VS 2010/2012) and Windows 8 64x (VS 2012), the VS versions were already installed on the operative systems.

Also if you can provide the steps that you follow as well as any issue that you faced installing the products will help a lot.

Thanks for your time.
[21 Feb 2015 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[4 Apr 2023 15:49] Tarek El Hajj
we are not able to connect Mysql to visual studio 2012 ,,, strange