Click here to Skip to main content
13,559,785 members
Rate this:
Please Sign up or sign in to vote.
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.
Posted 12-Nov-12 9:15am
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.
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

No problem with the DLL. The custom settings for the firewall blocked outbound connections from the Host Application in which the DLL runs.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

It doesn't matter if the remote server is 32 bit or 64 bit.

Can you connect using MySQL WorkBench?[^]

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web02-2016 | 2.8.180527.1 | Last Updated 23 Nov 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100