安装驱动程序管理器Installing the Driver Manager

下载下载 ODBC 驱动程序DownloadDownload ODBC Driver

本文包含说明 Linux 和 macOS 上的 SQL Server 与所有版本的 Microsoft ODBC 驱动程序安装 unixODBC 驱动程序管理器使用。This article contains instructions to install the unixODBC Driver Manager for use with all the versions of Microsoft ODBC Driver for SQL Server on Linux and macOS.

重要

在安装 unixODBC 驱动程序管理器之前,删除安装在计算机上的任何驱动程序管理器包。Delete any driver manager packages installed on your computer before you install the unixODBC Driver Manager. 安装 unixODBC 驱动程序管理器可能会导致现有驱动程序管理器出现故障。Installing the unixODBC Driver Manager could cause a failure of an existing Driver Manager.

为 Microsoft ODBC Driver 13、13.1 和 17 安装驱动程序管理器Installing the Driver Manager for Microsoft ODBC Driver 13, 13.1, and 17

驱动程序管理器解析依赖项自动通过程序包管理系统中的说明安装 Microsoft ODBC Driver 13、 13.1 或在 Linux 或 macOS 上的 SQL Server 的 17 时安装 Microsoft ODBC 驱动程序Linux 或 macOS 上的 SQL ServerThe driver manager dependency is resolved automatically by the package management system when you install the Microsoft ODBC Driver 13, 13.1, or 17 for SQL Server on Linux or macOS by following the instructions in Installing the Microsoft ODBC Driver for SQL Server on Linux or macOS.

为 Microsoft ODBC Driver 11 for SQL Server 安装驱动程序管理器Installing the Driver Manager for Microsoft ODBC Driver 11 for SQL Server

(SUSE 和仅限 Red Hat Linux。)(SUSE and Red Hat Linux only.)

使用安装脚本Using the Installation Script

重要

这些说明参考 Red Hat Linux 的安装文件 msodbcsql-11.0.2270.0.tar.gzThese instructions refer to msodbcsql-11.0.2270.0.tar.gz, which is the installation file for Red Hat Linux. 如果要安装适用于 SUSE Linux 的预览版,则文件名为 msodbcsql-11.0.2260.0.tar.gzIf you are installing the Preview for SUSE Linux, the file name is msodbcsql-11.0.2260.0.tar.gz.

若要安装驱动程序管理器:To install the driver manager:

  1. 请确保具有根权限。Make sure that you have root permission.

  2. 转到 MicrosoftMicrosoftSQL ServerSQL Server ODBC 驱动程序下载放置名为 msodbcsql-11.0.2270.0.tar.gz 的文件的目录。Go to the directory where the MicrosoftMicrosoftSQL ServerSQL Server ODBC Driver download placed the file called msodbcsql-11.0.2270.0.tar.gz. 确保所拥有的 *.tar.gz 文件与你的 Linux 版本匹配。Make sure that you have the *.tar.gz file that matches your version of Linux. 若要提取文件,请执行以下命令:tar xvzf msodbcsql-11.0.2270.0.tar.gzTo extract the files, execute the following command: tar xvzf msodbcsql-11.0.2270.0.tar.gz.

  3. 转到 msodbcsql-11.0.2270.0 目录,你应在此处看到一个名为 build_dm.sh 的文件。Change to the msodbcsql-11.0.2270.0 directory and there you should see a file called build_dm.sh. 你可以运行build_dm.sh来安装 unixODBC 驱动程序管理器。You can run build_dm.sh to install the unixODBC Driver Manager.

  4. 若要查看可用选项列表,请执行以下命令: ./build_dm.sh --helpTo see a list of the available options, execute the following command: ./build_dm.sh --help.

  5. 当已准备好安装且计算机可以通过 FTP 访问外部站点时,执行以下命令: ./build_dm.shWhen you are ready to install, and if your computer can access an external site via FTP, execute the following command: ./build_dm.sh.

如果计算机无法通过 FTP 访问外部站点,请获取 unixODBC-2.3.0.tar.gzIf your computer cannot access an external site via FTP, get unixODBC-2.3.0.tar.gz. 可以从 http://www.unixodbc.org 获取 unixODBC-2.3.0.tar.gz 。单击页面左侧的“下载”链接,转到下载页面 。You can get unixODBC-2.3.0.tar.gz from http://www.unixodbc.org. Click the Download link on the left side of the page to go to the download page. 然后,单击相应链接以下载 unixODBC-2.3.0(而非 unixODBC-2.3.1)。Then click the appropriate link to download unixODBC-2.3.0 (not unixODBC-2.3.1). 该版本的 MicrosoftMicrosoft ODBC Driver 11 for SQL ServerSQL Server 不支持 unixODBC-2.3.1。unixODBC-2.3.1 is not supported with this release of the MicrosoftMicrosoft ODBC Driver 11 for SQL ServerSQL Server. 执行以下命令以开始 unixODBC 驱动程序管理器安装: ./build_dm.sh --download-url=file://unixODBC-2.3.0.tar.gzExecute the following command to begin the unixODBC Driver Manager installation: ./build_dm.sh --download-url=file://unixODBC-2.3.0.tar.gz.

  1. 键入 YES 以继续解压缩文件 。Type YES to proceed with unpacking the files. 完成这部分过程最多需要 5 分钟。This part of the process can take up to five minutes to complete.

  2. 该脚本停止运行后,按照屏幕上的说明来安装 unixODBC 驱动程序管理器。After the script stops running, follow the instructions on the screen to install the unixODBC Driver Manager.

现在可以随时安装该驱动程序。You are now ready to install the driver. 有关详细信息,请参阅安装 Microsoft ODBC Driver for SQL Server Linux 和 macOS 上For more information, see Installing the Microsoft ODBC Driver for SQL Server on Linux and macOS.

手动安装Manual Installation

如果无法完成安装脚本,请自行配置并生成合适的驱动程序管理器。If the installation script is unable to complete, configure and build the proper driver manager yourself.

  1. 删除所有已安装的旧版 unixODBC(例如 unixODBC 2.2.11)。Remove any older installed version of unixODBC (for example, unixODBC 2.2.11). 在 Red Hat Enterprise Linux 5 或 6 上,执行以下命令:yum remove unixODBCOn Red Hat Enterprise Linux 5 or 6, execute the following command: yum remove unixODBC. SUSE Linux enterprise zypper 删除 unixODBCOn SUSE Linux Enterprise, zypper remove unixODBC.

  2. 转到 http://www.unixodbc.org。单击页面左侧的“下载”链接,转到下载页面 。Go to http://www.unixodbc.org. Click the Download link on the left side of the page to go to the download page. 然后,单击相应链接以将文件 unixODBC-2.3.0.tar.gz 保存到计算机。Then click the appropriate link to save the file unixODBC-2.3.0.tar.gz to your computer. 该版本的 MicrosoftMicrosoft ODBC Driver 11 for SQL ServerSQL Server 不支持 UnixODBC-2.3.1。UnixODBC-2.3.1 is not supported with this release of the MicrosoftMicrosoft ODBC Driver 11 for SQL ServerSQL Server.

  3. 在你的 Linux 计算机上执行该命令: tar xvzf unixODBC-2.3.0.tar.gzOn your Linux computer, execute the command: tar xvzf unixODBC-2.3.0.tar.gz.

  4. 转到 unixODBC-2.3.0 目录。Change to the unixODBC-2.3.0 directory.

  5. 在命令提示符处,执行以下命令: CPPFLAGS ="-DSIZEOF_LONG_INT = 8"At a command prompt, execute the command: CPPFLAGS="-DSIZEOF_LONG_INT=8".

  6. 在命令提示符处,执行以下命令:export CPPFLAGSAt a command prompt, execute the command: export CPPFLAGS.

  7. 在命令提示符处,执行以下命令: "./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc --enable-gui=no --enable-drivers=no --enable-iconv --with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LE" .At a command prompt, execute the command: "./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc --enable-gui=no --enable-drivers=no --enable-iconv --with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LE".

  8. 在命令提示符下(作为根登录),执行以下命令:makeAt a command prompt (logged in as root), execute the command: make.

  9. 在命令提示符下(作为根登录),执行以下命令:make installAt a command prompt (logged in as root), execute the command: make install.

现在可以随时安装该驱动程序。You are now ready to install the driver. 有关详细信息,请参阅安装 Microsoft ODBC Driver for SQL Server Linux 和 macOS 上For more information, see Installing the Microsoft ODBC Driver for SQL Server on Linux and macOS.

另请参阅See Also

在 Linux 和 macOS 上安装 Microsoft ODBC Driver for SQL ServerInstalling the Microsoft ODBC Driver for SQL Server on Linux and macOS

此版本驱动程序中的已知问题Known Issues in this Version of the Driver

发行说明Release Notes