LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-11-2017, 02:30 AM   #1
Lexus45
Member
 
Registered: Jan 2010
Distribution: Debian, Centos, Ubuntu, Slackware
Posts: 361
Blog Entries: 3

Rep: Reputation: 48
Debian 9 + ODBC + MariaDB


Hello all. I faced a problem with accessing the DB via ODBC.
The same configuration works well on Debian8 + ODBC + MySQL.

This is from Debian 9:

Code:
root@pbx:~# cat /etc/odbcinst.ini 
[MDBTools]
Description=MDBTools Driver
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmdbodbc.so
Setup=/usr/lib/x86_64-linux-gnu/odbc/libmdbodbc.so
FileUsage=1
UsageCount=1

root@pbx:~# cat /etc/odbc.ini 
[asterisk-connector]
Description           = MariaDB connection to 'asterisk' database
Driver                = MDBTools
Database              = db_asterisk_cdr
Server                = localhost
UserName              = asterisk
Password              = PaSs
Port                  = 3306
Socket                = /var/run/mysqld/mysqld.sock
Libraries described in odbcinst.ini are also present:
Code:
root@pbx:~# ls -l /usr/lib/x86_64-linux-gnu/odbc/libmdb*
-rw-r--r-- 1 root root 31728 Oct 25  2016 /usr/lib/x86_64-linux-gnu/odbc/libmdbodbc.so
-rw-r--r-- 1 root root 39920 Oct 25  2016 /usr/lib/x86_64-linux-gnu/odbc/libmdbodbcW.so
I also tried 'Setup=/usr/lib/x86_64-linux-gnu/odbc/libmdbodbcW.so' and even libodbcmyS.so taken from working Debian 8.
That trying was a result of reading https://unix.stackexchange.com/quest.../313859#313859 where it's written that Debian 9 does not have Setup library, only Driver one.

I successfully access the DB from console:
Code:
root@pbx:~# mysql -u asterisk -h localhost -p db_asterisk_cdr
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.23-MariaDB-9+deb9u1 Debian 9.0

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [db_asterisk_cdr]> show databases;
+--------------------+
| Database           |
+--------------------+
| db_asterisk_cdr    |
| information_schema |
+--------------------+
2 rows in set (0.00 sec)

MariaDB [db_asterisk_cdr]> SHOW GRANTS FOR 'asterisk'@'localhost';
+-----------------------------------------------------------------------------------------------------------------+
| Grants for asterisk@localhost                                                                                   |
+-----------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'asterisk'@'localhost' IDENTIFIED BY PASSWORD '*xxxxxxMD5xxxxx' |
| GRANT ALL PRIVILEGES ON `db_asterisk_cdr`.* TO 'asterisk'@'localhost'                                           |
+-----------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

MariaDB [db_asterisk_cdr]>
and the Asterisk-CDR-Viewer successfully shows the web page with table's content (direct connection to DB, not ODBC).


But the ODBC connection fails. I can not understand what is wrong:
Code:
root@pbx:~# isql -v asterisk-connector asterisk PaSs
File not found
File not found
Unable to locate database db_asterisk_cdr
[ISQL]ERROR: Could not SQLConnect
root@pbx:~#

What file is not found?!

Last edited by Lexus45; 08-11-2017 at 03:04 AM.
 
Old 08-11-2017, 03:09 AM   #2
Lexus45
Member
 
Registered: Jan 2010
Distribution: Debian, Centos, Ubuntu, Slackware
Posts: 361

Original Poster
Blog Entries: 3

Rep: Reputation: 48
Now I'm not sure if libmdbodbc.so is for MariaDB ?! Or it is for MS Access?!

But I have no libmaodbc.so at all, which is described as for MariaDB here https://unix.stackexchange.com/quest.../313859#313859

My packages:
Code:
root@pbx:~# dpkg -l | grep -i odbc
ii  libodbc1:amd64                2.3.4-1                           amd64        ODBC library for Unix
ii  odbc-mdbtools:amd64           0.7.1-5                           amd64        MDB tools ODBC driver
ii  odbcinst                      2.3.4-1                           amd64        Helper program for accessing odbc ini files
ii  odbcinst1debian2:amd64        2.3.4-1                           amd64        Support library for accessing odbc ini files
ii  unixodbc                      2.3.4-1                           amd64        Basic ODBC tools
Code:
root@pbx:~# dpkg -l | grep -i mariad
ii  libdbd-mysql-perl             4.041-2                           amd64        Perl5 database interface to the MariaDB/MySQL database
ii  libmariadbclient18:amd64      10.1.23-9+deb9u1                  amd64        MariaDB database client library
ii  mariadb-client                10.1.23-9+deb9u1                  all          MariaDB database client (metapackage depending on the latest version)
ii  mariadb-client-10.1           10.1.23-9+deb9u1                  amd64        MariaDB database client binaries
ii  mariadb-client-core-10.1      10.1.23-9+deb9u1                  amd64        MariaDB database core client binaries
ii  mariadb-common                10.1.23-9+deb9u1                  all          MariaDB common metapackage
ii  mariadb-server                10.1.23-9+deb9u1                  all          MariaDB database server (metapackage depending on the latest version)
ii  mariadb-server-10.1           10.1.23-9+deb9u1                  amd64        MariaDB database server binaries
ii  mariadb-server-core-10.1      10.1.23-9+deb9u1                  amd64        MariaDB database core server files
ii  mycli                         1.8.1-2                           all          CLI for MySQL/MariaDB
root@pbx:~#
 
Old 08-11-2017, 03:14 AM   #3
Lexus45
Member
 
Registered: Jan 2010
Distribution: Debian, Centos, Ubuntu, Slackware
Posts: 361

Original Poster
Blog Entries: 3

Rep: Reputation: 48
Oh.. It seems that I installed wrong package - odbc-mdbtools is for MS Access support.
Now I need ODBC support for MariaDB.

I was sure that "MDB" is "MariaDB" and that's why decided that I need it.
 
Old 08-11-2017, 04:13 AM   #4
Lexus45
Member
 
Registered: Jan 2010
Distribution: Debian, Centos, Ubuntu, Slackware
Posts: 361

Original Poster
Blog Entries: 3

Rep: Reputation: 48
FIXED.

Debian 9 does not have ODBC package/libs for MariaDB<-->ODBC.
We need to download them from here https://downloads.mariadb.org/connector-odbc/+releases/
I tried 3.0.1 which is BETA as for now. And it didn't work.
So I tried latest stable 2.0.15.

Just download it, unpack and move libmaodbc.so to /usr/lib/x86_64-linux-gnu/odbc/

And change odbcinst.ini of course:

Code:
[MariaDB]
Description=MariaDB
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so   # latest stable from https://downloads.mariadb.org/connector-odbc/+releases/
Setup=/usr/lib/x86_64-linux-gnu/odbc/libmdbodbc.so   # not sure if we need 'Setup' at all. As I understood, it's for GUI tool and as you see, 
                                                     # I steel have a wrong lib here :) but now everything works
FileUsage=1
UsageCount=1

Last edited by Lexus45; 08-11-2017 at 08:07 AM.
 
Old 08-11-2017, 09:44 AM   #5
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 9 Stretch
Posts: 2,349
Blog Entries: 8

Rep: Reputation: 383Reputation: 383Reputation: 383Reputation: 383
Heh, I can see where the confusion came from! FYI, "mdb" is the file extension of Access database files. This information should hopefully be useless to you because Access databases are ... well, just consider yourself lucky if you never see one in your lifetime.
 
Old 09-24-2017, 12:21 PM   #6
NickCoons
LQ Newbie
 
Registered: Aug 2005
Posts: 16

Rep: Reputation: 0
Lexus45, I see that you said you got this working. Even though you didn't mention it specifically, your ODBC configuration seems to indicate you're using this for Asterisk. Is that the case? If so, did you get that working?

I have the same setup (Debian 9, MariaDB 10.1, unixODBC 2.3.4, the MariaDB ODBC 2.0.15 connector, and Asterisk 13). Everything works all the way as far as isql, I can query the database with ODBC and all is well. But if I try to access ODBC via a running Asterisk instance, Asterisk segfaults and restarts. Have been working on this issue for about 8 hours and haven't been able to find any solution to it yet.
 
Old 10-13-2017, 10:39 AM   #7
sman123
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Rep: Reputation: Disabled
The just released Maria ODBC v3.0.2 package works as well.

Last edited by sman123; 10-13-2017 at 10:53 AM.
 
Old 04-18-2018, 11:11 AM   #8
nmirceac
LQ Newbie
 
Registered: Apr 2018
Posts: 3

Rep: Reputation: 0
still happening with debian9 stretch

isql shows that all works well for mysql odbc connectors and mariadb odbc connectors 2.0.* - maria odbc connectors versions 3.0.* do not work

the problem is asterisk connects to the odbc backend but crashes with segfault as soon as it's trying to read or write anything
 
Old 04-18-2018, 11:11 AM   #9
nmirceac
LQ Newbie
 
Registered: Apr 2018
Posts: 3

Rep: Reputation: 0
Quote:
Originally Posted by NickCoons View Post
Lexus45, I see that you said you got this working. Even though you didn't mention it specifically, your ODBC configuration seems to indicate you're using this for Asterisk. Is that the case? If so, did you get that working?

I have the same setup (Debian 9, MariaDB 10.1, unixODBC 2.3.4, the MariaDB ODBC 2.0.15 connector, and Asterisk 13). Everything works all the way as far as isql, I can query the database with ODBC and all is well. But if I try to access ODBC via a running Asterisk instance, Asterisk segfaults and restarts. Have been working on this issue for about 8 hours and haven't been able to find any solution to it yet.
have you ever managed to get it working?

thanks
 
Old 04-19-2018, 02:26 AM   #10
NickCoons
LQ Newbie
 
Registered: Aug 2005
Posts: 16

Rep: Reputation: 0
Quote:
Originally Posted by nmirceac View Post
have you ever managed to get it working?

thanks
Nope, I sure didn't. I ended up going a different route entirely.. not nearly as good, so it'd be nice if I could get this working, but I pretty much abandoned it when I couldn't find any solutions.
 
Old 04-19-2018, 03:28 AM   #11
nmirceac
LQ Newbie
 
Registered: Apr 2018
Posts: 3

Rep: Reputation: 0
Quote:
Originally Posted by NickCoons View Post
Nope, I sure didn't. I ended up going a different route entirely.. not nearly as good, so it'd be nice if I could get this working, but I pretty much abandoned it when I couldn't find any solutions.
Hi Nick - it was Debian's asterisk build that was... not up to standard
I tried it with Ubuntu 16.04 - same as above (Ubuntu comes with MySQL not MariaDB) but with the MySQL ODBC connector - it works as expected, like a dream - and super stable (only did like 3 calls - actually). No segmentation fault even when the connection is not working.
The rest of the setup is the same.

Oh - the main reason for me to swap cdr_mysql (which I've been using for ages) for odbc_* is CEL - I want channel event logging.
I'm not sure if I should go for realtime stuff. I was disappointed in the past by the res_mysql counterpart.

Ubuntu 1 - 0 Debian

Last edited by nmirceac; 04-19-2018 at 03:31 AM.
 
  


Reply

Tags
debian 9, mariadb, odbc


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Replicating a master database using MariaDB 10 on Debian 8 LXer Syndicated Linux News 0 04-19-2016 11:57 PM
install MariaDB on Debian Jessie problem lwinsa Linux - Server 3 01-04-2016 02:52 AM
LXer: How to install Wordpress with Nginx, MariaDB and HHVM on Debian 8 LXer Syndicated Linux News 0 08-07-2015 04:51 PM
LXer: Installing MariaDB and mod_ruid2 on Debian Squeeze LXer Syndicated Linux News 0 05-09-2012 09:40 AM
odbc connection on Debian Woody Skaan Linux - Newbie 2 05-31-2005 08:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration