User Tools

Site Tools


сервис_odbc

Сервис ODBC

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

Debian/Ubuntu

# apt install unixodbc

Установка коннектора MySQL

Debian 11

# apt install odbc-mariadb

Debian 9/10

debian9# wget http://val.bmstu.ru/unix/sql/mysql-connector-odbc-5.3.9-linux-debian9-x86-64bit.tar.gz

debian10# wget http://val.bmstu.ru/unix/sql/mysql-connector-odbc-5.3.14-linux-debian10-x86-64bit.tar.gz

# tar -xvf mysql-connector-odbc-5.3.*.tar.gz

# cp -v mysql-connector-odbc-5.3.*-linux-debian*-x86-64bit/lib/libmyodbc5* /usr/lib/x86_64-linux-gnu/odbc/

Debian 8/Ubuntu 16

# apt install libmyodbc

Настройка подключения

debian11# less /etc/odbcinst.ini

# cat /etc/odbcinst.ini
[myodbc_mysql]
Description=ODBC for MySQL
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5a.so
Setup=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5S.so
#UsageCount=2
# cat /etc/odbc.ini
[asterisk]
Description=DSN to asterisk mysql DB

Driver=myodbc_mysql
#Driver=MariaDB Unicode

###Server=localhost
###Port=3306
Socket=/var/run/mysqld/mysqld.sock

USER=asterisk
Password=asterisk
Database=asterisk

ReadOnly=No
Charset=utf8

Проверка подключения

# isql -v asterisk
SQL> show tables;

SQL> select * from cdr;
SQL> select fullname from sipfriends;

SQL> quit
сервис_odbc.txt · Last modified: 2021/11/09 13:07 by val