Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

debian 9 + odbc + mariadb : [01000] Can't open lib , file not found

I install that:

sudo apt-get install unixodbc unixodbc-dev

I download mariadb-connector-odbc-3.0.2-ga-debian-x86_64.tar.gz from here https://downloads.mariadb.com/Connectors/odbc/connector-odbc-3.0.2/ and copy libmaodbc.so from archive to /usr/lib/x86_64-linux-gnu/odbc/

Next I configure odbcinst.ini:

[MariaDB]
Description=MariaDB
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so   
Setup=/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so 
FileUsage=1

and next odbc.ini:

[ast-con]
Description           = MariaDB connection to 'asterisk' database
Driver                = MariaODBC
Database              = AsteriskDB
Server                = localhost
UserName              = zk
Password              = rt131cvn
Port                  = 3306
Socket                = /var/run/mysqld/mysqld.sock

Command:

root@asterisk:/etc# odbcinst -q -d
[MariaODBC]

Next I try to check odbc with isql:

root@asterisk:/etc# isql -v ast-con
[01000][unixODBC][Driver Manager]Can't open lib '/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so   # latest stable from https://downloads.mariadb.org/connector-odbc/+releases/' : file not found
[ISQL]ERROR: Could not SQLConnect

I try search google, and find 1 solution, but it doesn't help:

I set LD_LIBRARY_PATH

root@asterisk:/etc# env
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/odbc
SSH_CONNECTION=xx.xxx.xxx.xxx 64759 xx.xxx.xxx.xx 22
OLDPWD=/root
XDG_SESSION_ID=26153
USER=root
PWD=/etc
HOME=/root
SSH_CLIENT=xx.xxx.xxx.xxx 64759 22
SSH_TTY=/dev/pts/0
MAIL=/var/mail/root
TERM=xterm
SHELL=/bin/bash
SHLVL=1
LOGNAME=root
XDG_RUNTIME_DIR=/run/user/0
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/env

Next command:

root@asterisk:/etc# ldd /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
        linux-vdso.so.1 (0x00007fffad26f000)
        libodbcinst.so.2 => /usr/lib/x86_64-linux-gnu/libodbcinst.so.2 (0x00007f5ad171d000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5ad1419000)
        libssl.so.1.0.0 => not found
        libcrypto.so.1.0.0 => not found
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5ad107a000)
        libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f5ad0e6e000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5ad0c51000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f5ad1be9000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f5ad0a4d000)

Usually there is libodbcinst.so.1 => not found and then exec something like this: ln -s libodbcinst.so.1 libodbcinst.so.2.0.0

but my result is different, and I can not to understand what should I do ? Help please!

like image 803
Morph Avatar asked Nov 08 '17 12:11

Morph


People also ask

Does MySQL ODBC work with MariaDB?

Yes, MySQL's Connector/J is compatible with MariaDB.

What is MariaDB ODBC driver?

MariaDB Connector/ODBC is a database driver that uses the industry standard Open Database Connectivity (ODBC) API. Some of the key features of the driver are: It is LGPL-licensed. It is compliant with the ODBC 3.5 standard. It can be used as a drop-in replacement for MySQL Connector/ODBC.

How to install MariaDB ODBC driver windows 10?

Windows (MSI)Go to the MariaDB Connector/ODBC download page. In the "OS" dropdown, select "MS Windows 64-bit" or "MS Windows 32-bit," depending on whether you need a 64-bit or 32-bit library. Click the "Download" button to download the MSI package. Run the MSI package and click "Next" to start the Setup Wizard.


2 Answers

This is very annoying and I've narrowed it down to a few things:

  • If you follow the instructions, Debian will be installing libssl-dev for you, however libmaodbc.so is linked to libssl.so.1.0.0 and libcrypto.so.1.0.0 -- therefore it will encounter ENOENT (No such file or directory) when trying to find these two .so, hence throwing out "file not found" error (doing an strace on the command will provide you with details that it has found the libmaodbc.so file, but not the two other files)

  • Even if you do manage to get libssl1.0-dev it will remove other packages that are required for FreePBX/Asterisk.

  • Even then, it will still fail on libc.mo searching for locales en_US

The solution to this is to find another libmaodbc.so that is linked properly against libssl1.1

like image 186
Chevraut Avatar answered Oct 14 '22 05:10

Chevraut


i have same problem, try older driver version eg /mariadb-connector-odbc-2.0.15-ga-debian-x86_64 work for me!

like image 43
0xdeface Avatar answered Oct 14 '22 05:10

0xdeface