Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ database
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?
 
Enviroment:
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 10:15am
Comments
Member 3615972 at 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 at 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
good
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.
  Permalink  
Rate this: bad
good
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?
 
http://www.mysql.com/downloads/workbench/[^]
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 6,045
1 DamithSL 4,611
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,310


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 23 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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