Asterisk 20.5 - Mariadb ODBC configuration error

Hi all,

I’m trying to configure Asterisk 20.5 with ODBC on Almalinux 8 (same as Redhat8)
Asterisk seem not to found the entry “asteriskconfig” in /etc/odbc.ini linux file

My configuration :

odbc.ini

[asteriskconfig]
Description=MySQL Asterisk database
Driver=MariaDB
SERVER=localhost
USER=ZZZZZZ
PASSWORD=XXXXXXX
PORT=3306
DATABASE=asterisk_config
option=3

res_odbc.conf

[asteriskconfig]
enabled => yes
dsn => asteriskconfig
username => YYYYYYYY
password => ZZZZZZZZZ
database => asterisk_config
pre-connect => yes
max_connections => 5

Error on asterisk :

[Dec 13 16:05:25] WARNING[62587]: res_odbc.c:1060 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found and no default driver specified
[Dec 13 16:05:25] NOTICE[62587]: res_odbc.c:697 load_odbc_config: Registered ODBC class 'asteriskconfig' dsn->[asteriskconfig]

odbcinst -i -s -l -f /etc/odbc.ini —> IS OK

odbcinst -s -q
[asteriskconfig]

odbcinst -j

unixODBC 2.3.7
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

Whether Driver=MariaDB is correct depends on what has been defined in odbcinst.ini.

Seem to be ok for the /etc/odbcinst.ini

# Driver from the mariadb-connector-odbc package
# Setup from the unixODBC package
[MariaDB]
Description     = ODBC for MariaDB
Driver          = /usr/lib/libmaodbc.so
Driver64        = /usr/lib64/libmaodbc.so
FileUsage       = 1

Should work, but you error message suggests that it is your setup and not Asterisk.

I’ve reboot the server and the ODBC is ok now ?!?!?

If that worked, then it would have been sufficient to restart Asterisk, or just simply reloading the database modules.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.