MySQL ODBC 32 位与 64 位

发布于 2024-08-23 19:48:47 字数 132 浏览 4 评论 0原文

我有一个 32 位应用程序,必须使用 64 位版本的 MySQL 在 Windows x64 服务器上运行。
我应该使用 32 位 ODBC 驱动程序还是 64 位 ODBC 驱动程序?
或者我也应该安装 32 位版本的 MySQL?

I have a 32-bit application that must run on a Windows x64 server using a 64-bit version of MySQL.
Should I use a 32-bit ODBC driver or a 64-bit ODBC driver?
Or should I install a 32-bit version of MySQL too?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

絕版丫頭 2024-08-30 19:48:47

您需要安装 32 位 SQL 和 ODBC 驱动程序,看看您的应用程序是 32 位的。出于兼容性原因。

我仍在寻找,将编辑。

** 编辑

要解决此问题,请使用适当版本的 ODBC 管理器工具。如果您在 64 位操作系统上构建并作为 32 位应用程序运行应用程序,则必须使用 %windir%\SysWOW64\odbcad32.exe 中的 ODBC 管理器工具创建 ODBC 数据源。要指示 DSN 的类型,您可以将“_32”添加到 32 位用户 DSN,将“_64”添加到 64 位用户 DSN。

来自Microsoft 支持

** 编辑

如果您想要解决方法,您需要使用 中的管理工具创建 ODBC 数据源。
同一链接中也对此进行了解释。

%windir%\SysWOW64\odbcad32.exe

You would need to install a 32-bit SQL and ODBC driver seeing as how your application is in 32-bit. For compatibility reasons.

I am still searching, will edit.

** EDIT

To work around this problem, use the appropriate version of the ODBC Administrator tool. If you build and then run an application as a 32-bit application on a 64-bit operating system, you must create the ODBC data source by using the ODBC Administrator tool in %windir%\SysWOW64\odbcad32.exe. To indicate the type of DSN, you can add "_32" to the 32-bit user DSNs and "_64" to the 64-bit user DSNs.

From Microsoft support.

** EDIT

If you want to have a workaround, you need to create you ODBC data source by using the Admin tool found in.
This is also explained in the same link.

%windir%\SysWOW64\odbcad32.exe
往昔成烟 2024-08-30 19:48:47

我能够

  1. 在 Windows 64 位上安装 ODBC 32 位

  2. 运行我的应用程序(32 位)
    32 位 ODBC 可以“对抗”64 位
    64 位 Windows 操作系统 (2008 R2) 上的 MySQL

要实现1)我必须修改MySQL ODBC的zip包中提供的install.bat,以考虑到32位驱动程序必须安装在c中:\windows\syswow64

@ECHO OFF
REM #########################################################
REM
REM \brief  Install myodbc.
REM
REM         This exists for those working with the Windows source
REM         distribution.
REM
REM \sa     README.win
REM
REM #########################################################

SET installdir=none
IF EXIST %windir%\system\nul   SET installdir=%windir%\system
IF EXIST %windir%\system32\nul SET installdir=%windir%\system32

REM ****************************
REM * check syswow64 folder too ...
REM ****************************
IF EXIST %windir%\syswow64\nul SET installdir=%windir%\syswow64

IF %installdir%==none GOTO :doError5


IF "%1"=="1" GOTO :doDebug
IF "%1"=="0" GOTO :doNormal
GOTO doSyntax

:doNormal

REM ****************************
REM * syswow64 must be specified
REM ****************************
IF EXIST %installdir%\myodbc3i.exe GOTO :doError4

REM ****
REM * Find out the bin/lib directory, or use default
REM ****
SET libdir=lib
SET bindir=bin
IF EXIST lib\release\myodbc3.lib         SET libdir=lib\release
IF EXIST lib\relwithdebinfo\myodbc3.lib  SET libdir=lib\relwithdebinfo
IF EXIST bin\release\myodbc3i.exe        SET bindir=bin\release
IF EXIST bin\relwithdebinfo\myodbc3i.exe SET bindir=bin\relwithdebinfo

REM ****
REM * Copying myodbc libraries and executables to install dir...
REM ****
IF NOT EXIST %bindir%\myodbc3c.exe GOTO :doError2
IF NOT EXIST %libdir%\myodbc3.lib  GOTO :doError2
IF NOT EXIST %libdir%\myodbc3S.lib GOTO :doError2
IF NOT EXIST %bindir%\myodbc3i.exe GOTO :doError2
IF NOT EXIST %bindir%\myodbc3m.exe GOTO :doError2
copy %libdir%\myodbc3S.dll %installdir%
copy %libdir%\myodbc3S.lib %installdir%
copy %libdir%\myodbc3.dll  %installdir%
copy %libdir%\myodbc3.lib  %installdir%
copy %bindir%\myodbc3i.exe      %installdir%
copy %bindir%\myodbc3m.exe      %installdir%
copy %bindir%\myodbc3c.exe      %installdir%
copy doc\*.hlp             %installdir%

REM ****
REM * Registering driver...
REM *
REM * We can do this with myodbc3i.exe or the MS Windows ODBCConf.exe. It
REM * may be safer to use the ODBCConf.exe when we think about such things
REM * as 64bit windows.
REM ****

REM ****************************
REM * syswow64 must be specified
REM ****************************
%installdir%\myodbc3i -a -d -t"MySQL ODBC 3.51 Driver;DRIVER=%installdir%\myodbc3.dll;SETUP=%installdir%\myodbc3S.dll"

GOTO doSuccess

:doDebug
REM ****
REM * Find out the bin/lib directory, or use default
REM ****
SET libdir=lib
IF EXIST lib\debug\myodbc3d.lib          SET libdir=lib\debug

IF NOT EXIST %libdir%\myodbc3d.lib goto doError3
IF NOT EXIST %libdir%\myodbc3E.lib goto doError3
IF NOT EXIST %installdir%\myodbc3i.exe goto doError1
REM ****
REM * Copying myodbc debug libraries to install dir...
REM ****
copy %libdir%\myodbc3E.dll %installdir%
copy %libdir%\myodbc3E.lib %installdir%
copy %libdir%\myodbc3d.dll %installdir%
copy %libdir%\myodbc3d.lib %installdir%

REM ****
REM * Registering driver...
REM ****

REM ****************************
REM * syswow64 must be specified
REM ****************************
%installdir%\myodbc3i -a -d -t"MySQL ODBC 3.51 Driver (debug);DRIVER=myodbc3d.dll;SETUP=myodbc3E.dll"

goto doSuccess


:doSuccess
ECHO "+-----------------------------------------------------+"
ECHO "| DONE                                                |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| Hopefully things went well; the Connector/ODBC      |"
ECHO "| files have been copied to the system directory      |"
ECHO "| and the driver has been registered.                 |"
ECHO "|                                                     |"
ECHO "| Connector/ODBC is ready to use.                     |"
ECHO "|                                                     |"
ECHO "| The most common thing to do next is to go to the    |"
ECHO "| Control Panel and find the ODBC Administrator -     |"
ECHO "| then use it to create a Data Source Name (DSN)      |"
ECHO "| so you (and your application) can connect to a      |"
ECHO "| MySQL server.                                       |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"
EXIT /B 0

:doError1
ECHO "+-----------------------------------------------------+"
ECHO "| ERROR                                               |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| The non-debug version of Connector/ODBC needs to be |"
ECHO "| installed.                                          |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"
PAUSE
EXIT /B 1

:doError2
ECHO "+-----------------------------------------------------+"
ECHO "| ERROR                                               |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| Connector/ODBC not built. Consider executing        |"
ECHO "| Build.bat.                                          |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"
PAUSE
EXIT /B 1

:doError3
ECHO "+-----------------------------------------------------+"
ECHO "| ERROR                                               |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| Connector/ODBC (debug) not built. Consider executing|"
ECHO "| Build.bat.                                          |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"
PAUSE
EXIT /B 1

:doError4
ECHO "+-----------------------------------------------------+"
ECHO "| ERROR                                               |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| Existing Connector/ODBC installed. Request ignored. |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"
PAUSE
EXIT /B 1

:doError5
ECHO "+-----------------------------------------------------+"
ECHO "| ERROR                                               |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| Can't find the Windows system directory             |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"
PAUSE
EXIT /B 1

:doSyntax
ECHO "+-----------------------------------------------------+"
ECHO "| Install.bat                                         |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| DESCRIPTION                                         |"
ECHO "|                                                     |"
ECHO "| Use this to copy the driver and supporting files    |"
ECHO "| to the system directory and register the driver.    |"
ECHO "|                                                     |"
ECHO "| You can not properly install the debug version      |"
ECHO "| without first installing the regular version.       |"
ECHO "|                                                     |"
ECHO "| SYNTAX                                              |"
ECHO "|                                                     |"
ECHO "| Install <debug>                                     |"
ECHO "|                                                     |"
ECHO "| <debug>  must be;                                   |"
ECHO "|              0 - to install a regular build         |"
ECHO "|              1 - to install a debug version         |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"

I was able to

  1. install ODBC 32-bit on Windows 64-bit

  2. have my application (32-bit) running
    fine with 32-bit ODBC "against" 64-bit
    MySQL on 64-bit Windows OS (2008 R2)

To achieve 1) I had to modify install.bat provided with the zip package of MySQL ODBC to take into account the fact that the 32-bit driver must be installed in c:\windows\syswow64.

@ECHO OFF
REM #########################################################
REM
REM \brief  Install myodbc.
REM
REM         This exists for those working with the Windows source
REM         distribution.
REM
REM \sa     README.win
REM
REM #########################################################

SET installdir=none
IF EXIST %windir%\system\nul   SET installdir=%windir%\system
IF EXIST %windir%\system32\nul SET installdir=%windir%\system32

REM ****************************
REM * check syswow64 folder too ...
REM ****************************
IF EXIST %windir%\syswow64\nul SET installdir=%windir%\syswow64

IF %installdir%==none GOTO :doError5


IF "%1"=="1" GOTO :doDebug
IF "%1"=="0" GOTO :doNormal
GOTO doSyntax

:doNormal

REM ****************************
REM * syswow64 must be specified
REM ****************************
IF EXIST %installdir%\myodbc3i.exe GOTO :doError4

REM ****
REM * Find out the bin/lib directory, or use default
REM ****
SET libdir=lib
SET bindir=bin
IF EXIST lib\release\myodbc3.lib         SET libdir=lib\release
IF EXIST lib\relwithdebinfo\myodbc3.lib  SET libdir=lib\relwithdebinfo
IF EXIST bin\release\myodbc3i.exe        SET bindir=bin\release
IF EXIST bin\relwithdebinfo\myodbc3i.exe SET bindir=bin\relwithdebinfo

REM ****
REM * Copying myodbc libraries and executables to install dir...
REM ****
IF NOT EXIST %bindir%\myodbc3c.exe GOTO :doError2
IF NOT EXIST %libdir%\myodbc3.lib  GOTO :doError2
IF NOT EXIST %libdir%\myodbc3S.lib GOTO :doError2
IF NOT EXIST %bindir%\myodbc3i.exe GOTO :doError2
IF NOT EXIST %bindir%\myodbc3m.exe GOTO :doError2
copy %libdir%\myodbc3S.dll %installdir%
copy %libdir%\myodbc3S.lib %installdir%
copy %libdir%\myodbc3.dll  %installdir%
copy %libdir%\myodbc3.lib  %installdir%
copy %bindir%\myodbc3i.exe      %installdir%
copy %bindir%\myodbc3m.exe      %installdir%
copy %bindir%\myodbc3c.exe      %installdir%
copy doc\*.hlp             %installdir%

REM ****
REM * Registering driver...
REM *
REM * We can do this with myodbc3i.exe or the MS Windows ODBCConf.exe. It
REM * may be safer to use the ODBCConf.exe when we think about such things
REM * as 64bit windows.
REM ****

REM ****************************
REM * syswow64 must be specified
REM ****************************
%installdir%\myodbc3i -a -d -t"MySQL ODBC 3.51 Driver;DRIVER=%installdir%\myodbc3.dll;SETUP=%installdir%\myodbc3S.dll"

GOTO doSuccess

:doDebug
REM ****
REM * Find out the bin/lib directory, or use default
REM ****
SET libdir=lib
IF EXIST lib\debug\myodbc3d.lib          SET libdir=lib\debug

IF NOT EXIST %libdir%\myodbc3d.lib goto doError3
IF NOT EXIST %libdir%\myodbc3E.lib goto doError3
IF NOT EXIST %installdir%\myodbc3i.exe goto doError1
REM ****
REM * Copying myodbc debug libraries to install dir...
REM ****
copy %libdir%\myodbc3E.dll %installdir%
copy %libdir%\myodbc3E.lib %installdir%
copy %libdir%\myodbc3d.dll %installdir%
copy %libdir%\myodbc3d.lib %installdir%

REM ****
REM * Registering driver...
REM ****

REM ****************************
REM * syswow64 must be specified
REM ****************************
%installdir%\myodbc3i -a -d -t"MySQL ODBC 3.51 Driver (debug);DRIVER=myodbc3d.dll;SETUP=myodbc3E.dll"

goto doSuccess


:doSuccess
ECHO "+-----------------------------------------------------+"
ECHO "| DONE                                                |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| Hopefully things went well; the Connector/ODBC      |"
ECHO "| files have been copied to the system directory      |"
ECHO "| and the driver has been registered.                 |"
ECHO "|                                                     |"
ECHO "| Connector/ODBC is ready to use.                     |"
ECHO "|                                                     |"
ECHO "| The most common thing to do next is to go to the    |"
ECHO "| Control Panel and find the ODBC Administrator -     |"
ECHO "| then use it to create a Data Source Name (DSN)      |"
ECHO "| so you (and your application) can connect to a      |"
ECHO "| MySQL server.                                       |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"
EXIT /B 0

:doError1
ECHO "+-----------------------------------------------------+"
ECHO "| ERROR                                               |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| The non-debug version of Connector/ODBC needs to be |"
ECHO "| installed.                                          |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"
PAUSE
EXIT /B 1

:doError2
ECHO "+-----------------------------------------------------+"
ECHO "| ERROR                                               |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| Connector/ODBC not built. Consider executing        |"
ECHO "| Build.bat.                                          |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"
PAUSE
EXIT /B 1

:doError3
ECHO "+-----------------------------------------------------+"
ECHO "| ERROR                                               |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| Connector/ODBC (debug) not built. Consider executing|"
ECHO "| Build.bat.                                          |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"
PAUSE
EXIT /B 1

:doError4
ECHO "+-----------------------------------------------------+"
ECHO "| ERROR                                               |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| Existing Connector/ODBC installed. Request ignored. |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"
PAUSE
EXIT /B 1

:doError5
ECHO "+-----------------------------------------------------+"
ECHO "| ERROR                                               |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| Can't find the Windows system directory             |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"
PAUSE
EXIT /B 1

:doSyntax
ECHO "+-----------------------------------------------------+"
ECHO "| Install.bat                                         |"
ECHO "+-----------------------------------------------------+"
ECHO "|                                                     |"
ECHO "| DESCRIPTION                                         |"
ECHO "|                                                     |"
ECHO "| Use this to copy the driver and supporting files    |"
ECHO "| to the system directory and register the driver.    |"
ECHO "|                                                     |"
ECHO "| You can not properly install the debug version      |"
ECHO "| without first installing the regular version.       |"
ECHO "|                                                     |"
ECHO "| SYNTAX                                              |"
ECHO "|                                                     |"
ECHO "| Install <debug>                                     |"
ECHO "|                                                     |"
ECHO "| <debug>  must be;                                   |"
ECHO "|              0 - to install a regular build         |"
ECHO "|              1 - to install a debug version         |"
ECHO "|                                                     |"
ECHO "+-----------------------------------------------------+"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文