Меню Рубрики

Установка odbc драйвера ubuntu

Install the Microsoft ODBC driver for SQL Server (Linux)

This article explains how to install the Microsoft ODBC Driver for SQL Server on Linux. It also includes instructions for the optional command-line tools for SQL Server ( bcp and sqlcmd ) and the unixODBC development headers.

This article provides commands for installing the ODBC driver from the bash shell. If you want to download the packages directly, see Download ODBC Driver for SQL Server.

Microsoft ODBC 17

The following sections explain how to install the Microsoft ODBC driver 17 from the bash shell for different Linux distributions.

If you installed the v17 msodbcsql package that was briefly available, you should remove it before installing the msodbcsql17 package. This will avoid conflicts. The msodbcsql17 package can be installed side by side with the msodbcsql v13 package.

Alpine Linux

Driver version 17.5 or higher is required for Alpine support.

Debian

You can substitute setting the environment variable ‘ACCEPT_EULA’ with setting the debconf variable ‘msodbcsql/ACCEPT_EULA’ instead: echo msodbcsql17 msodbcsql/ACCEPT_EULA boolean true | sudo debconf-set-selections

Red Hat Enterprise Server and Oracle Linux

SUSE Linux Enterprise Server

Ubuntu

  • Driver version 17.2 or higher is required for Ubuntu 18.04 support.
  • Driver version 17.3 or higher is required for Ubuntu 18.10 support.

You can substitute setting the environment variable ‘ACCEPT_EULA’ with setting the debconf variable ‘msodbcsql/ACCEPT_EULA’ instead: echo msodbcsql17 msodbcsql/ACCEPT_EULA boolean true | sudo debconf-set-selections

Previous versions

The following sections provide instructions for installing previous versions of the Microsoft ODBC driver on Linux. The following driver versions are covered:

ODBC 13.1

The following sections explain how to install the Microsoft ODBC driver 13.1 from the bash shell for different Linux distributions.

Debian 8

RedHat Enterprise Server 6

RedHat Enterprise Server 7

SUSE Linux Enterprise Server 11

SUSE Linux Enterprise Server 12

Ubuntu 15.10

Ubuntu 16.04

Ubuntu 16.10

ODBC 13

The following sections explain how to install the Microsoft ODBC driver 13 from the bash shell for different Linux distributions.

RedHat Enterprise Server 6

RedHat Enterprise Server 7

Ubuntu 15.10

Ubuntu 16.04

SUSE Linux Enterprise Server 12

Offline installation

If you prefer/require the Microsoft ODBC Driver 13 to be installed on a computer with no internet connection, you will need to resolve package dependencies manually. The Microsoft ODBC Driver 13 has the following direct dependencies:

  • Ubuntu: libc6 (>= 2.21), libstdc++6 (>= 4.9), libkrb5-3, libcurl3, openssl, debconf (>= 0.5), unixodbc (>= 2.3.1-1)
  • Red Hat: glibc, e2fsprogs, krb5-libs, openssl, unixODBC
  • SUSE: glibc, libuuid1, krb5, openssl, unixODBC

Each of these packages in turn has their own dependencies, which may or may not be present on the system. For a general solution to this issue, refer to your distribution’s package manager documentation: Redhat, Ubuntu, and SUSE

It is also common to manually download all the dependent packages and place them together on the installation computer, then manually install each package in turn, finishing with the Microsoft ODBC Driver 13 package.

Redhat Linux Enterprise Server 7

Ubuntu 16.04

SUSE Linux Enterprise Server 12

After you have completed the package installation, you can verify that the Microsoft ODBC Driver 13 can find all its dependencies by running ldd and inspecting its output for missing libraries:

ODBC 11

The following sections explain how to install the Microsoft ODBC driver 11 on Linux. Before you can use the driver, install the unixODBC driver manager. For more information, see Installing the Driver Manager.

Installation Steps

These instructions refer to msodbcsql-11.0.2270.0.tar.gz , which is installation file for Red Hat Linux. If you are installing the Preview for SUSE Linux, the file name is msodbcsql-11.0.2260.0.tar.gz .

Make sure that you have root permission.

Change to the directory where the download placed the file msodbcsql-11.0.2270.0.tar.gz . Make sure that you have the *.tar.gz file that matches your version of Linux. To extract the files, execute the following command, tar xvzf msodbcsql-11.0.2270.0.tar.gz .

Change to the msodbcsql-11.0.2270.0 directory and there you should see a file called install.sh.

To see a list of the available installation options, execute the following command: ./install.sh.

Make a backup of odbcinst.ini. The driver installation updates odbcinst.ini. odbcinst.ini contains the list of drivers that are registered with the unixODBC Driver Manager. To discover the location of odbcinst.ini on your computer, execute the following command: odbc_config —odbcinstini .

Before you install the driver, execute the following command: ./install.sh verify . The output of ./install.sh verify reports if your computer has the required software to support the ODBC driver on Linux.

When you are ready to install the ODBC driver on Linux, execute the command: ./install.sh install . If you need to specify an install command ( bin-dir or lib-dir ), specify the command after the install option.

After reviewing the license agreement, type YES to continue with the installation.

Installation puts the driver in /opt/microsoft/msodbcsql/11.0.2270.0 . The driver and its support files must be in /opt/microsoft/msodbcsql/11.0.2270.0 .

To verify that the Microsoft ODBC driver on Linux was registered successfully, execute the following command: odbcinst -q -d -n «ODBC Driver 11 for SQL Server» .

Uninstall

You can uninstall the ODBC driver 11 on Linux by executing the following commands:

rm -rf /opt/microsoft/msodbcsql

odbcinst -u -d -n «ODBC Driver 11 for SQL Server»

Driver files

The ODBC driver on Linux consists of the following components:

Component Description
libmsodbcsql-17.X.so.X.X or libmsodbcsql-13.X.so.X.X The shared object ( so ) dynamic library file that contains all of the driver’s functionality. This file is installed in /opt/microsoft/msodbcsql17/lib64/ for the Driver 17 and in /opt/microsoft/msodbcsql/lib64/ for Driver 13.
msodbcsqlr17.rll or msodbcsqlr13.rll The accompanying resource file for the driver library. This file is installed in [driver .so directory]../share/resources/en_US/
msodbcsql.h The header file that contains all of the new definitions needed to use the driver.

Note: You cannot reference msodbcsql.h and odbcss.h in the same program.

msodbcsql.h is installed in /opt/microsoft/msodbcsql17/include/ for Driver 17 and in /opt/microsoft/msodbcsql/include/ for Driver 13.

LICENSE.txt The text file that contains the terms of the End-User License Agreement. This file is placed in /usr/share/doc/msodbcsql17/ for Driver 17 and in /usr/share/doc/msodbcsql/ for Driver 13.
RELEASE_NOTES The text file that contains release notes. This file is placed in /usr/share/doc/msodbcsql17/ for Driver 17 and in /usr/share/doc/msodbcsql/ for Driver 13.

Resource file loading

The driver needs to load the resource file in order to function. This file is called msodbcsqlr17.rll or msodbcsqlr13.rll depending on the driver version. The location of the .rll file is relative to the location of the driver itself ( so or dylib ), as noted in the table above. As of version 17.1 the driver will also attempt to load the .rll from the default directory if loading from the relative path fails. The default resource file path on Linux is /opt/microsoft/msodbcsql17/share/resources/en_US/ .

Troubleshooting

If you are unable to make a connection to SQL Server using the ODBC driver, see the known issues article on troubleshooting connection problems.

Next steps

After installing the driver, you can try the C++ ODBC example application. For more information about developing ODBC applications, see Developing Applications.

For more information, see the ODBC driver release notes and system requirements.

источник

Как установить драйвер MySQL ODBC в UBUNTU 16.04?

Казалось бы, простая задача установить драйвер ODBC для MySQL в Ubuntu 16.04 свелась к нетривиальному процессу. Всё из-за того, что разработчики Ubuntu не справились с задачей обновления драйвера. Установив последнюю версию Ubuntu 16.04 вы, вероятно, уже столкнулись с проблемой поиска драйвера ODBC:

# apt-get install libmyodbc Reading package lists. Done Building dependency tree Reading state information. Done Package libmyodbc is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package ‘libmyodbc’ has no installation candidate

Доступ к предыдущим версиям MySQL можно было получить через приложения на основе ODBC, установив соответствующий драйвер простой командой:

Что же касается новой версии операционной системы Ubuntu, поиски в ее репозиториях определенно не увенчаются успехом: такого пакета больше не существует. Согласно архивам его удалили после обнаружения соответствующего бага.

Последняя версия MySQL 5.7 в отличие от предыдущих ограничивает символы в библиотеке клиентов libmysqlclient20. Вероятно, в MyODBC используются данные символы, поэтому он не может быть установлен из libmysqlclient-dev.

Вопрос поддержки драйвера MyODBC в Ubuntu остается спорным: каких-либо зависимых от него объектов не имеется, и он является своего рода альтернативой по умолчанию для пакета libreoffice-canzeley-client.

Таким образом, драйвер MyODBC, в котором используются более не совместимые с библиотекой клиентов libmysqlclient функции новой версии MySQL 5.7, пока не поддерживается в Ubuntu 16.04. Как только работа над MySQL 5.7 будет завершена, разработчики Ubuntu, возможно, вернут его. Однако такого может и не произойти.

Если у вас есть необходимость в драйвере MySQL ODBC в UBUNTU 16.04, установить его можно. Для этой цели проделайте следующие шаги:

  1. С сайта MySQL скачиваем драйвер для Ubuntu 15.10 (mysql-connector-odbc-5.3.6-linux-ubuntu15.10-x86-64bit.tar.gz)
  2. Распаковываем: tar -xvf mysql-connector-odbc-5.3.6-linux-ubuntu15.10-x86-64bit.tar.gz
  3. Копируем драйвер в папку для ODBC: sudo cp mymysql-connector-odbc-5.3.6-linux-ubuntu15.10-x86-64bit/lib/libmyodbc5* /usr/lib/x86_64-linux-gnu/odbc/
  4. Инсталлируем mysql-connector-odbc-5.3.6-linux-ubuntu15.10-x86-64bit/bin/myodbc-installer -d -a -n «MySQL» -t «DRIVER=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5w.so;»

Проверяем, что всё работает:

  1. Создаём DSN: sudo ./bin/myodbc-installer -s -a -c2 -n «test» -t «DRIVER=MySQL;SERVER=127.0.0.1;DATABASE=mysql;U >
  2. Подключаемся и делаем запрос:
  3. В итоге получается следующая конфигурация в файлах:

Драйвер ODBC в UBUNTU 16.04 установлен. Теперь ваше программное обеспечение без труда сможет подключиться к базе данных MySQL по протоколу TCP/IP.

источник

Installing Ubuntu 16.04 LTS: How to install ODBC?

After installing a fresh new copy of Ubuntu 16.04, I tried to install MySQL ODBC as per the official documentation at https://help.ubuntu.com/community/ODBC:

I can see this is getting off to a great start!

Searching the package repository for ODBC hasn’t been particularly helpful either. This is a very important part of any modern Linux system! Where did it go?!

PS: Updating the documentation at help.ubuntu.com would be nice too!

Edited to add: Also, it seems that the driver file libmyodbc.so doesn’t exist on this version of Ubuntu.

3 Answers 3

Select Ubuntu 16.04 64 bit or 32 bit (probably 64 bit), download the TAR ball, then copy the file libmyodbc5a.so to /usr/lib/x86_64-linux-gnu/odbc/

then, create /etc/odbcinst.ini

Note that the username tag is User (and not username as seen in some examples) and the socket is under /var/run and not under /var/lib

The package is available for Xenial and it can be seen here. Therefore, it should install. Make sure you run a sudo apt-get update before installing. Also, make sure that the universe repository for Xenial is part of your sources (as the above link shows, this package belongs to the universe repository). You can check this source is part of your available sources in the etc/apt/sources.list file. There should be a line such as:

(The mirror could be different from com.archive. )

If still you cannot install it (which is strange), then go to the above website, choose you architecture version and download the .deb file. For example, for amd64, the file is this one: http://launchpadlibrarian.net/141005765/libmyodbc_5.1.10-3_amd64.deb. Then, open a terminal, go to the folder containing the file and run:

(The latter command is in case some dependencies are unmet)

I found it in http://dev.mysql.com/downloads/connector/odbc/ (I selected «Ubuntu Linux 15.10 (x86, 64-bit), Compressed TAR Archive»)

Dowload it and extract files, then you get libmyodbc5a.so (for ANSI system) and libmyodbc5w.so (for Unicode).

Not the answer you’re looking for? Browse other questions tagged 16.04 mysql odbc or ask your own question.

Linked

Related

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0 with attribution required. rev 2020.3.30.36412

источник

Установка MS SQL ODBC Driver под Linux и сборка плагина для Qt 5.9

Несколько дней назад встал вопрос о написании консольного приложения, которое будет работать в Linux CentOS 7 и взаимодействовать с MS SQL Server 2012. Мне очень нравится Qt и я решил, что воспользуюсь им для решения этой задачи. И если под Windows я достаточно быстро настроил необходимое окружение, то под Linux я столкнулся с проблемами, которые очень тяжело было решить с помощью гуглинга. Этому вопросу я посвятил полтора дня. Считаю полезным поделиться своим опытом, возможно кому-то это поможет сэкономить драгоценное время.

Инструменты

Я не хочу тянуть на сервер исходники Qt, для того чтобы собрать плагин и само приложение. Поэтому беру образ CentOS 7 LiveGNOME и устанавливаю его на VirtualBox машину. После делаю полный апдейт, и ставлю VirtualBox Guest Additions.

Скачиваю установщик Qt для Linux x64. Устанавливаю Qt 5.9.1, дополнительно при установке выбираю галочку Source, чтобы получить исходники.

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

Согласно инструкции устанавливаю драйвер:

Драйвер нужно установить как на VirtualBox, так и на машину, где будет работать софт.

Сборка Qt плагина QODBC

Следуя инструкции, скачиваем куда-нибудь unixODBC, распаковываем. Теперь нам нужно собрать unixODBC и установить. В документации Qt, а так же в других источниках в основном я встречал примеры, которые предполагают установку unixODBC в /usr/local/unixODBC. Тут дело вкуса конечно, но я буду использовать именно такое расположение. Так же файлы конфигов драйверов я хочу поместить в /usr/local/etc Для этого нужно сконфигурировать unixODBC со следующими параметрами:

Затем собираем и устанавливаем:

Теперь необходимо настроить конфигурацию Microsoft ODBC Driver for SQL Server. Для этого переходим в /usr/local/unixODBC/bin и выполняем:

Если вы устанавливали драйвер как было описано выше, то расположение файла odbcinst.ini будет именно таким. Иначе вам нужно определить свой путь. Все эти действия нужно выполнить и на Virtualbox машине и на рабочей.

Теперь нужно собрать Qt плагин для работы с ODBC драйвером. И с этого момента начинаются проблемы, которые частично связаны с багом, который еще не пофиксили. Для того, чтобы собрать плагин придется применить некоторые костыли. Если у кого-то возникнет более элегантный вариант костыля, пожалуйста напишите в комментариях.

Итак, для сборки в штатных условиях нам нужно выполнить простую процедуру. Переходим в QT_DIR/5.9.1/Src/qtbase/src/plugins/sqldrivers/odbc и выполняем:

Но из-за того, что имеем баг, скорее всего вы получите ошибку:

На отсутствие файла qtsqldrivers-config.pri, можно не обращать внимание, а вот вторая ошибка не даст нам собрать плагин. Чтобы ее избежать нужно закомменитровать в файле odbc.pro строчку:

После этого повторим вызов qmake:

И получим на выходе Makefile. Еще одна проблема с которой я столкнулся это флаги компилятора -Wdate_time и -std=c++1z, которые вызывали ошибку сборки.

На этот момент я уже потратил много времени, чтобы хоть как-то собрать плагин, поэтому эту проблему я решил жестко, просто открыл сгенерированный Makefile и изменил -std=c++1z на -std=c++11, а флаг -Wdate_time просто удалил. Эти пары флагов встречаются в двух местах. Можно установить более свежий gcc, или может кто-то подскажет есть ли возможность указать для qmake какие-то параметры, чтобы использовать c++11 вместо c++17?

Как бы вы ни поступили, теперь можно выполнить:

Тестовое приложение

Я создал консольное приложение в Qt и написал следующий код для тестирования соединения:

Собираем проект на Virtualbox машине. Запускаем, убеждаемся, что все работает. После этого собираем Release версию программы. Я не буду сейчас описывать процесс деплоя Qt приложений. Возможно это тема для еще одной публикации. Я опишу лишь ключевые моменты.

источник

Install the Microsoft ODBC driver for SQL Server (Linux)

This article explains how to install the Microsoft ODBC Driver for SQL Server on Linux. It also includes instructions for the optional command-line tools for SQL Server ( bcp and sqlcmd ) and the unixODBC development headers.

This article provides commands for installing the ODBC driver from the bash shell. If you want to download the packages directly, see Download ODBC Driver for SQL Server.

Microsoft ODBC 17

The following sections explain how to install the Microsoft ODBC driver 17 from the bash shell for different Linux distributions.

If you installed the v17 msodbcsql package that was briefly available, you should remove it before installing the msodbcsql17 package. This will avoid conflicts. The msodbcsql17 package can be installed side by side with the msodbcsql v13 package.

Alpine Linux

Driver version 17.5 or higher is required for Alpine support.

Debian

You can substitute setting the environment variable ‘ACCEPT_EULA’ with setting the debconf variable ‘msodbcsql/ACCEPT_EULA’ instead: echo msodbcsql17 msodbcsql/ACCEPT_EULA boolean true | sudo debconf-set-selections

Red Hat Enterprise Server and Oracle Linux

SUSE Linux Enterprise Server

Ubuntu

  • Driver version 17.2 or higher is required for Ubuntu 18.04 support.
  • Driver version 17.3 or higher is required for Ubuntu 18.10 support.

You can substitute setting the environment variable ‘ACCEPT_EULA’ with setting the debconf variable ‘msodbcsql/ACCEPT_EULA’ instead: echo msodbcsql17 msodbcsql/ACCEPT_EULA boolean true | sudo debconf-set-selections

Previous versions

The following sections provide instructions for installing previous versions of the Microsoft ODBC driver on Linux. The following driver versions are covered:

ODBC 13.1

The following sections explain how to install the Microsoft ODBC driver 13.1 from the bash shell for different Linux distributions.

Debian 8

RedHat Enterprise Server 6

RedHat Enterprise Server 7

SUSE Linux Enterprise Server 11

SUSE Linux Enterprise Server 12

Ubuntu 15.10

Ubuntu 16.04

Ubuntu 16.10

ODBC 13

The following sections explain how to install the Microsoft ODBC driver 13 from the bash shell for different Linux distributions.

RedHat Enterprise Server 6

RedHat Enterprise Server 7

Ubuntu 15.10

Ubuntu 16.04

SUSE Linux Enterprise Server 12

Offline installation

If you prefer/require the Microsoft ODBC Driver 13 to be installed on a computer with no internet connection, you will need to resolve package dependencies manually. The Microsoft ODBC Driver 13 has the following direct dependencies:

  • Ubuntu: libc6 (>= 2.21), libstdc++6 (>= 4.9), libkrb5-3, libcurl3, openssl, debconf (>= 0.5), unixodbc (>= 2.3.1-1)
  • Red Hat: glibc, e2fsprogs, krb5-libs, openssl, unixODBC
  • SUSE: glibc, libuuid1, krb5, openssl, unixODBC

Each of these packages in turn has their own dependencies, which may or may not be present on the system. For a general solution to this issue, refer to your distribution’s package manager documentation: Redhat, Ubuntu, and SUSE

It is also common to manually download all the dependent packages and place them together on the installation computer, then manually install each package in turn, finishing with the Microsoft ODBC Driver 13 package.

Redhat Linux Enterprise Server 7

Ubuntu 16.04

SUSE Linux Enterprise Server 12

After you have completed the package installation, you can verify that the Microsoft ODBC Driver 13 can find all its dependencies by running ldd and inspecting its output for missing libraries:

ODBC 11

The following sections explain how to install the Microsoft ODBC driver 11 on Linux. Before you can use the driver, install the unixODBC driver manager. For more information, see Installing the Driver Manager.

Installation Steps

These instructions refer to msodbcsql-11.0.2270.0.tar.gz , which is installation file for Red Hat Linux. If you are installing the Preview for SUSE Linux, the file name is msodbcsql-11.0.2260.0.tar.gz .

Make sure that you have root permission.

Change to the directory where the download placed the file msodbcsql-11.0.2270.0.tar.gz . Make sure that you have the *.tar.gz file that matches your version of Linux. To extract the files, execute the following command, tar xvzf msodbcsql-11.0.2270.0.tar.gz .

Change to the msodbcsql-11.0.2270.0 directory and there you should see a file called install.sh.

To see a list of the available installation options, execute the following command: ./install.sh.

Make a backup of odbcinst.ini. The driver installation updates odbcinst.ini. odbcinst.ini contains the list of drivers that are registered with the unixODBC Driver Manager. To discover the location of odbcinst.ini on your computer, execute the following command: odbc_config —odbcinstini .

Before you install the driver, execute the following command: ./install.sh verify . The output of ./install.sh verify reports if your computer has the required software to support the ODBC driver on Linux.

When you are ready to install the ODBC driver on Linux, execute the command: ./install.sh install . If you need to specify an install command ( bin-dir or lib-dir ), specify the command after the install option.

After reviewing the license agreement, type YES to continue with the installation.

Installation puts the driver in /opt/microsoft/msodbcsql/11.0.2270.0 . The driver and its support files must be in /opt/microsoft/msodbcsql/11.0.2270.0 .

To verify that the Microsoft ODBC driver on Linux was registered successfully, execute the following command: odbcinst -q -d -n «ODBC Driver 11 for SQL Server» .

Uninstall

You can uninstall the ODBC driver 11 on Linux by executing the following commands:

rm -rf /opt/microsoft/msodbcsql

odbcinst -u -d -n «ODBC Driver 11 for SQL Server»

Driver files

The ODBC driver on Linux consists of the following components:

Component Description
libmsodbcsql-17.X.so.X.X or libmsodbcsql-13.X.so.X.X The shared object ( so ) dynamic library file that contains all of the driver’s functionality. This file is installed in /opt/microsoft/msodbcsql17/lib64/ for the Driver 17 and in /opt/microsoft/msodbcsql/lib64/ for Driver 13.
msodbcsqlr17.rll or msodbcsqlr13.rll The accompanying resource file for the driver library. This file is installed in [driver .so directory]../share/resources/en_US/
msodbcsql.h The header file that contains all of the new definitions needed to use the driver.

Note: You cannot reference msodbcsql.h and odbcss.h in the same program.

msodbcsql.h is installed in /opt/microsoft/msodbcsql17/include/ for Driver 17 and in /opt/microsoft/msodbcsql/include/ for Driver 13.

LICENSE.txt The text file that contains the terms of the End-User License Agreement. This file is placed in /usr/share/doc/msodbcsql17/ for Driver 17 and in /usr/share/doc/msodbcsql/ for Driver 13.
RELEASE_NOTES The text file that contains release notes. This file is placed in /usr/share/doc/msodbcsql17/ for Driver 17 and in /usr/share/doc/msodbcsql/ for Driver 13.

Resource file loading

The driver needs to load the resource file in order to function. This file is called msodbcsqlr17.rll or msodbcsqlr13.rll depending on the driver version. The location of the .rll file is relative to the location of the driver itself ( so or dylib ), as noted in the table above. As of version 17.1 the driver will also attempt to load the .rll from the default directory if loading from the relative path fails. The default resource file path on Linux is /opt/microsoft/msodbcsql17/share/resources/en_US/ .

Troubleshooting

If you are unable to make a connection to SQL Server using the ODBC driver, see the known issues article on troubleshooting connection problems.

Next steps

After installing the driver, you can try the C++ ODBC example application. For more information about developing ODBC applications, see Developing Applications.

For more information, see the ODBC driver release notes and system requirements.

источник

Читайте также:  Установка реечного замка для гаража

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