Установка microsoft odbc driver for sql server (linux)install the microsoft odbc driver for sql server (linux)

Поддержка операционных системOperating system support

Версии 17, 13.1 и 13 драйверов Linux и macOS поддерживаются для архитектур x64 следующих операционных систем:Versions 17, 13.1, and 13 of the Linux and macOS drivers are supported on the x64 architecture of the following operating systems:

Поддерживаемые операционные системыSupported Operating System 17.517.5 17.417.4 17.317.3 17.217.2 17.117.1 17.017.0 Версия 13.113.1 1313
Apple OS X 10.11 (El Capitan)Apple OS X 10.11 (El Capitan) ДаY ДаY ДаY ДаY ДаY ДаY ДаY
Apple macOS 10.12 (Sierra)Apple macOS 10.12 (Sierra) ДаY ДаY ДаY ДаY ДаY ДаY ДаY
Apple macOS 10.13 (High Sierra)Apple macOS 10.13 (High Sierra) ДаY ДаY ДаY ДаY ДаY ДаY ДаY ДаY
Apple macOS 10.14 (Mojave)Apple macOS 10.14 (Mojave) ДаY ДаY ДаY
Apple macOS 10.15 (Catalina)Apple macOS 10.15 (Catalina) ДаY
Alpine Linux 3.11Alpine Linux 3.11 ДаY
Debian Linux 8Debian Linux 8 ДаY ДаY ДаY ДаY ДаY ДаY ДаY
Debian Linux 9Debian Linux 9 ДаY ДаY ДаY ДаY ДаY ДаY ДаY ДаY
Debian Linux 10Debian Linux 10 ДаY ДаY
Oracle Linux 8Oracle Linux 8 ДаY
RedHat Enterprise Linux 6RedHat Enterprise Linux 6 ДаY ДаY ДаY ДаY ДаY ДаY ДаY ДаY
RedHat Enterprise Linux 7RedHat Enterprise Linux 7 ДаY ДаY ДаY ДаY ДаY ДаY ДаY ДаY
RedHat Enterprise Linux 8RedHat Enterprise Linux 8 ДаY ДаY
SUSE Linux Enterprise Server 111SUSE Linux Enterprise Server 111 ДаY ДаY ДаY ДаY ДаY ДаY ДаY ДаY
SUSE Linux Enterprise Server 12SUSE Linux Enterprise Server 12 ДаY ДаY ДаY ДаY ДаY ДаY ДаY ДаY
SUSE Linux Enterprise Server 15SUSE Linux Enterprise Server 15 ДаY ДаY ДаY
Ubuntu Linux 14.04Ubuntu Linux 14.04 ДаY ДаY ДаY ДаY ДаY ДаY ДаY
Ubuntu Linux 16.04Ubuntu Linux 16.04 ДаY ДаY ДаY ДаY ДаY ДаY ДаY ДаY
Ubuntu Linux 18.04Ubuntu Linux 18.04 ДаY ДаY ДаY ДаY
Ubuntu Linux 19.10Ubuntu Linux 19.10 ДаY

1 Драйвер ODBC версии 17 поддерживает только SUSE Linux Enterprise Server 11 SP41 ODBC Driver 17 supports SUSE Linux Enterprise Server 11 SP4 only

Пакеты установки для MicrosoftMicrosoft ODBC Driver 13, 13.1 и 17 for SQL ServerSQL Server в Linux и macOS разрешают зависимости драйвера автоматически при установке с помощью системы управления пакетами дистрибутива, как описано в разделах Установка ODBC Driver (Linux) и Установка ODBC Driver (macOS).The installation packages for the MicrosoftMicrosoft ODBC Driver 13, 13.1, and 17 for SQL ServerSQL Server on Linux and macOS resolve the driver’s dependencies automatically when installed using the package management system of your distribution, as described in Install the ODBC Driver (Linux) and Install the ODBC Driver (macOS).

Установка Microsoft ODBC Driver for SQL ServerInstalling Microsoft ODBC Driver for SQL Server

Драйвер устанавливается при запуске из одной из .The driver is installed when you run from one of the .

Примечание

Для тех, кто установил драйвер 17.1.0.1 или ниже, рекомендуется удалить его вручную перед установкой новой версии драйвера.For those who have Driver 17.1.0.1 or below installed, it is recommended that it be uninstalled manually prior to installing the newer version of the Driver.

Параллельно с Native ClientSide-by-side with Native Client

Драйвер можно установить параллельно с SQL ServerSQL Server Native Client.The driver can be installed side-by-side with SQL ServerSQL Server Native Client. Основные версии драйвера (11, 13, 17) могут быть установлены параллельно друг с другом.Major versions of the driver (11, 13, 17) can all be installed side-by-side with each other, as well.

При инициировании по умолчанию устанавливаются только клиентские компоненты.When you invoke , only the client components are installed by default. Этими компонентами служат файлы, поддерживающие работу приложения, разработанного с помощью драйвера.The client components are files that support running an application that was developed using the driver. Чтобы установить компоненты пакета SDK, укажите в командной строке .To install the SDK components, specify on the command line. Ниже приведен пример.Here is an example.

Лицензия пользователяEnd-user license

Укажите , чтобы принять условия лицензионного соглашения, если для установки используется параметр , , или .Specify to accept the terms of the end-user license if you use the , , , or option to install. Этот параметр указывается только прописными буквами.This option must be specified in all uppercase letters. Ниже приведен пример.Here is an example.

Удаление без взаимодействия с пользователемSilent uninstall

В следующем примере показано выполнение удаления без взаимодействия с пользователем.The following example shows how to perform a silent uninstall.

Указание зависимостьIndicate dependency

Если приложение использует драйвер, оно должно указывать, что зависит от драйвера, с помощью параметра установки .When an application uses the driver, the application should indicate that it depends on the driver through the install option . Это позволяет установщику драйвера вывести сведения о зависимых приложениях перед удалением.this indication enables the driver installer to report dependent applications before uninstalling. Чтобы задать зависимость от драйвера, присвойте параметру командной строки код продукта при автоматической установке драйвера.To specify a dependency on the driver, set the command-line parameter to your product code when silently installing the driver. Код продукта необходимо создать при использовании установщика (Майкрософт) для формирования пакета установки приложения.A product code must be created when using Microsoft Installer to bundle your application setup program. Ниже приведен пример.Here is an example.

Usage

All of the following examples assume you have already created a
connection . See for more information on
establishing a connection.

Table and Field information

is used for listing all existing tables in a database.

dbListTables(con)

# List tables beginning with f
dbListTables(con, table_name = "f%")

# List all fields in the 'flights' database
dbListFields(con, "flights")

will read a full table into an R .

data <- dbReadTable(con, "flights")

will write an R to an SQL table.

data <- dbWriteTable(con, "iris", iris)

Querying

will submit a query and fetch the results. It is also
possible to submit the query and fetch separately with
and . The argument to can be used to fetch
only the part of a query result (the next n
rows).

result <- dbSendQuery(con, "SELECT flight, tailnum, origin FROM flights ORDER BY origin")

# Retrieve the first 100 results
first_100 <- dbFetch(result, n = 100)

# Retrieve the rest of the results
rest <- dbFetch(result)

Источники данных OLE DB

Для подключения через OLE DB не требуется регистрация источника данных в системе, как это принято в ODBC.
Вся информация хранится либо в файлах с расширением udl, либо указывается непосредственно в строке подключения.

Для редактирования подключения OLE DB с расширением udl ассоциирован редактор связей с данными Data Link.
Он поддерживает расширенную настройку провайдера данных за счет включения в свой интерфейс дополнительных страниц,
о которых ему сообщает выбранный OLE DB провайдер.

Чтобы запустить редактор Data Link создайте пустой файл с расширением udl и запустите его на выполнение.

OpenSSLOpenSSL

Начиная с версии 17.4, драйвер загружает OpenSSL динамически, что позволяет запускать его на системах, имеющих версию 1.0, либо 1.1, без надобности в отдельных файлах драйверов.Starting with version 17.4, the driver loads OpenSSL dynamically, which allows it to run on systems that have either version 1.0 or 1.1 without a need for separate driver files. При наличии нескольких версий OpenSSL драйвер пытается загрузить последнюю версию.When multiple versions of OpenSSL are present, the driver will attempt to load the latest one. Сейчас драйвер поддерживает OpenSSL 1.0.x и 1.1.xThe driver currently supports OpenSSL 1.0.x and 1.1.x

Примечание

При этом возможен конфликт, если приложение, использующее драйвер (или один из его компонентов), связано с другой версией OpenSSL или динамически загружает ее.A potential conflict may occur if the application that uses the driver (or one of its components) is linked with or dynamically loads a different version of OpenSSL. Если в системе присутствует несколько версий OpenSSL и приложение используют их, настоятельно рекомендуется убедится, что версии, загруженные приложением и драйвером, совпадают, так как ошибки могут привести к повреждению памяти и, таким образом, они не обязательно будут проявляться очевидным или последовательным образом.If several versions of OpenSSL are present on the system and the application uses it, it is highly recommended that one be extra careful in making sure that the version loaded by the application and the driver do not mismatch, as the errors could corrupt memory and thus will not necessarily manifest in obvious or consistent ways.

Installation

After installation of the driver manager and driver, you will have to
register the driver in a file
for it to appear in .

Windows

Windows is bundled with ODBC libraries however drivers for each database
need to be installed separately. Windows ODBC drivers typically include
an installer that needs to be run and will install the driver to the
proper locations.

MacOS

# Install the unixODBC library
brew install unixodbc
# Microsoft SQL Server ODBC Drivers (Recommended)
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
brew install msodbcsql17 mssql-tools

# SQL Server ODBC Drivers (Free TDS)
brew install freetds

# PostgreSQL ODBC ODBC Drivers
brew install psqlodbc

# MySQL ODBC Drivers (and database)
brew install mysql

# SQLite ODBC Drivers
brew install sqliteodbc

Linux — Debian / Ubuntu

# SQL Server ODBC Drivers (Free TDS)
apt-get install tdsodbc

# PostgreSQL ODBC ODBC Drivers
apt-get install odbc-postgresql

# MySQL ODBC Drivers
apt-get install libmyodbc

# SQLite ODBC Drivers
apt-get install libsqliteodbc
# Install the latest odbc release from CRAN:
install.packages("odbc")

# Or the the development version from GitHub:
# install.packages(devtools)
devtools::install_github("r-dbi/odbc")

Дополнительные замечанияAdditional Notes

  1. Вы можете создать выделенное административное соединение с использованием проверки подлинности SQL ServerSQL Server и комбинации узел,порт.You can make a dedicated administrator connection (DAC) using SQL ServerSQL Server authentication and host,port. Члену роли Sysadmin сначала нужно сначала обнаружить порт выделенного административного соединения.A member of the Sysadmin role first needs to discover the DAC port. Инструкции см. в статье .See to discover how. Например, если бы порт выделенного административного соединения имел значение 33000, вы могли бы подключиться к нему с помощью следующим образом:For example, if the DAC port were 33000, you could connect to it with as follows:

    Примечание

    Выделенные административные соединения должны использовать проверку подлинности SQL ServerSQL Server.DAC connections must use SQL ServerSQL Server Authentication.

  2. Диспетчер драйверов UnixODBC возвращает «Недопустимый идентификатор атрибута или параметра» для всех атрибутов инструкции, когда они передаются через SQLSetConnectAttr.The UnixODBC driver manager returns «invalid attribute/option identifier» for all statement attributes when they are passed through SQLSetConnectAttr. Когда в Windows SQLSetConnectAttr получает значение атрибута инструкции, он заставляет драйвер установить это значение для всех активных инструкций, являющихся дочерними элементами дескриптора соединения.On Windows, when SQLSetConnectAttr receives a statement attribute value, it causes the driver to set that value on all active statements which are children of the connection handle.

  3. При использовании драйвера с очень многопоточными приложениями проверка обработки unixODBC может стать узким местом производительности.When using the driver with highly multithreaded applications, unixODBC’s handle validation may become a performance bottleneck. Вы можете получить большую производительность в таких сценариях, выполнив компиляцию unixODBC с параметром .In such scenarios, significantly more performance may be obtained by compiling unixODBC with the option. Однако следует помнить, что это может привести к аварийному завершению работы приложений, которые передают в ODBC API некорректные дескрипторы, вместо того, чтобы возвращать ошибки .However, beware that this may cause applications which pass invalid handles to ODBC APIs to crash instead of returning errors.

Доступные функцииAvailable Features

Следующие разделы документации по SQL ServerSQL Server Native Client для ODBC (SQL Server Native Client (ODBC)) применяются при использовании драйвера ODBC в macOS и Linux:The following sections from the SQL ServerSQL Server Native Client documentation for ODBC (SQL Server Native Client (ODBC)) are valid when using the ODBC driver on macOS and Linux:

  • Взаимодействие с SQL Server (ODBC)Communicating with SQL Server (ODBC)
  • Поддержка времени ожидания соединения и запросаConnection and query timeout support
  • КурсорыCursors
  • Улучшенная обработка даты и времени (ODBC)Date/Time Improvements (ODBC)
  • Выполнение запросов (ODBC)Executing Queries (ODBC)
  • Обработка ошибок и сообщенийHandling Errors and Messages
  • Проверка подлинности KerberosKerberos authentication
  • Определяемые пользователем типы данных больших значений CLR (ODBC)Large CLR User-Defined Types (ODBC)
  • Выполнение транзакций (ODBC) (за исключением распределенных транзакций)Performing Transactions (ODBC) (except distributed transactions)
  • Обработка результатов (ODBC)Processing Results (ODBC)
  • Выполнение хранимых процедурRunning Stored Procedures
  • Поддержка разреженных столбцов (ODBC)Sparse Columns Support (ODBC)
  • Использование шифрования без проверкиUsing Encryption Without Validation
  • Возвращающие табличные значения параметрыTable Valued Parameters
  • UTF-8 и UTF-16 для команд и API данныхUTF-8 and UTF-16 for command and data API
  • Использование функций каталогаUsing Catalog Functions

Альтернатива ODBC — OLE DB провайдер.

OLE DB (или OLEDB) — Object Linking and Embedding, Database.
Технология OLE DB появилась позже ODBC и стала развитием идей корпорации Microsoft о стандартных интерфейсах доступа к данным.

OLE DB, в отличие от ODBC, является объектно-ориентированным API, основанным на COM-интерфейсах.

OLE DB провайдеры могут работать не только с реляционными базами данных,
но и с любой другой информацией которую можно представить в табличном виде.
Например: OLE DB провайдер для служб каталогов или Jet OLE DB провайдер, позволяющий извлекать данные из Excel и Outlook.

Справка:

В OLE DB можно работать и с ODBC драйвером при помощи специального провайдера
(OLE DB Provider for ODBC drivers), который умеет подключаться к источникам данных ODBC.
Данная схема помогала в случае отсутствия OLE DB провайдера для конкретной базы данных.
На сегодняшний день поддержка этого драйвера прекращена.

ODBC 11ODBC 11

В следующих разделах объясняется, как установить Microsoft ODBC Driver 11 в Linux.The following sections explain how to install the Microsoft ODBC driver 11 on Linux. Для использования драйвера сначала установите диспетчер драйверов unixODBC.Before you can use the driver, install the unixODBC driver manager. Дополнительные сведения: Установка диспетчера драйверов.For more information, see Installing the Driver Manager.

Процесс установкиInstallation Steps

Важно!

Эти инструкции ссылаются на (файл установки для Red Hat Linux).These instructions refer to , which is installation file for Red Hat Linux. В случае установке предварительной версии для SUSE Linux файл называется .If you are installing the Preview for SUSE Linux, the file name is .

Порядок установки драйвераTo install the driver:

  1. Убедитесь, что у вас есть корневое разрешение.Make sure that you have root permission.

  2. Перейдите в каталог, куда был скачан файл с именем .Change to the directory where the download placed the file . Убедитесь в наличии файла *.TAR.GZ, который соответствует вашей версии Linux.Make sure that you have the *.tar.gz file that matches your version of Linux. Чтобы извлечь файлы, выполните следующую команду: .To extract the files, execute the following command, .

  3. Перейдите в каталог , где должен находиться файл install.sh.Change to the directory and there you should see a file called install.sh.

  4. Чтобы просмотреть список доступных параметров установки, выполните следующую команду: ./install.sh.To see a list of the available installation options, execute the following command: ./install.sh.

  5. Создайте резервную копию odbcinst.ini.Make a backup of odbcinst.ini. Установка драйвера обновляет odbcinst.ini.The driver installation updates odbcinst.ini. Файл odbcinst.ini содержит список драйверов, которые зарегистрированы с помощью диспетчера драйверов unixODBC.odbcinst.ini contains the list of drivers that are registered with the unixODBC Driver Manager. Чтобы определить на компьютере расположение файла odbcinst.ini, выполните следующую команду: .To discover the location of odbcinst.ini on your computer, execute the following command: .

  6. Перед установкой драйвера выполните следующую команду: .Before you install the driver, execute the following command: . Выходные данные команды показывают, есть ли на компьютере ПО, необходимое для поддержки драйвера ODBC на Linux.The output of reports if your computer has the required software to support the ODBC driver on Linux.

  7. Когда вы будете готовы установить драйвер ODBC на Linux, выполните команду: .When you are ready to install the ODBC driver on Linux, execute the command: . Если вам нужно будет дополнительно указать команду установки ( или ), сделайте это после параметра install.If you need to specify an install command ( or ), specify the command after the install option.

  8. После просмотра лицензионного соглашения введите YES для продолжения установки.After reviewing the license agreement, type YES to continue with the installation.

При установке драйвер помещается в папку .Installation puts the driver in . Драйвер и его вспомогательные файлы должны находиться в папке .The driver and its support files must be in .

Для проверки, что драйвер ODBC в Linux зарегистрирован, выполните следующую команду: .To verify that the Microsoft ODBC driver on Linux was registered successfully, execute the following command: .

УдалениеUninstall

Вы можете удалить драйвер ODBC 11 на Linux, выполнив следующие команды:You can uninstall the ODBC driver 11 on Linux by executing the following commands:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *