Click here to Skip to main content
15,920,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've developed a 64 bit MFC DLL wich needs to connect to a remote MySQL database on 32 bit server.
Used C++ MFC ODBC Consumer class derived from CRecordset.
When opening the Recordset
CustomRecordset.Open(CRecordset::snapshot,L"DSN",CRecordset::none) ODBC Dialog shows Cannot connect to MYSQL Server.
Created DSN's with both odbc administrators in C:\Windows\System32 and C:\Windows\SysWOW64. Not success.

It seems to me that the ODBC driver manager needs to communicate 64 bits application with driver in 32 bit mode.
However it's doing so in 64 bit mode, because in a localhost MySQL server (64 bits) the connection is successful.

May be it's neccesary to add any Macro or Connection Handle instruction into the DLL source code?

OS: Win 7 64 bits Ultimate
IDE: MS Visual Studio 10.0
Connection Driver installed: MySQL ODBC Connector 5.1.11 64 bits
The DLL runs into a 64 bit C++ Host Application.
Member 3615972 12-Nov-12 17:37pm    
Of course, remote connection can be done using MySQL WorkBench and even through the
ODBC administrator, creating and testing the connection.
I will continue looking for a solutin.
Member 3615972 18-Nov-12 18:47pm    
I have built the driver mysqlodbc5.dll from source code provided by MYSQL and through debugger I found that the error message returned by SQLDriverConnectW is SQL_STATE=[HY000] Native Error 2003. Can't connect to MYSQL Server at IP xxxx (10013). Looks like a net access error but I can connect to the server creating DSN through odbca32.exe. I will try to link directly to the driver and ignore the driver manager odbc32.lib in linker settings. If no result, perhaps I will look forward C++ connector.

No problem with the DLL. The custom settings for the firewall blocked outbound connections from the Host Application in which the DLL runs.
Share this answer
It doesn't matter if the remote server is 32 bit or 64 bit.

Can you connect using MySQL WorkBench?[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900