从MFC 64位DLL到32位服务器数据库的连接 [英] Connection from MFC 64 bits DLL to a 32 bits Server Database

查看:131
本文介绍了从MFC 64位DLL到32位服务器数据库的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个64位MFC DLL,但它需要连接到32位服务器上的远程MySQL数据库.
从CRecordset派生的C ++ MFC ODBC消费者类.
打开记录集时
CustomRecordset.Open(CRecordset :: snapshot,L"DSN",CRecordset :: none)ODBC对话框显示无法连接到MYSQL Server.
由两位odbc管理员在C:\ Windows \ System32和C:\ Windows \ SysWOW64中创建了DSN.没有成功.

在我看来,ODBC驱动程序管理器需要在32位模式下与驱动程序通信64位应用程序.
但是,它是在64位模式下执行此操作的,因为在localhost MySQL服务器(64位)中,连接成功.

将任何宏或连接句柄指令添加到DLL源代码中可能是必要的吗?

环境:
操作系统:Win 7 64 bits Ultimate
IDE:MS Visual Studio 10.0
已安装连接驱动程序:MySQL ODBC Connector 5.1.11 64位
DLL运行到64位C ++主机应用程序中.

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.

推荐答案

远程服务器是32位还是64位都没有关系.
可以使用MySQL WorkBench进行连接吗?

http://www.mysql.com/downloads/workbench/ [
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/[^]


DLL没有问题.防火墙的自定义设置阻止了运行DLL的主机应用程序的出站连接.
No problem with the DLL. The custom settings for the firewall blocked outbound connections from the Host Application in which the DLL runs.


这篇关于从MFC 64位DLL到32位服务器数据库的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆