No database handle available with the name of 'database_name' (check res_odbc.conf)

Hi All,
I’m running the asterisk server on a docker container and connected a docker volume that consists of all asterisk configuration data.

All my configurations are stored under that folder and my sip peers and queues are stored in a Postgres database. but when opening a CLI of Asterisk which running on the docker container, it shows this error :

 ERROR[654]: res_config_odbc.c:200 realtime_odbc: No database handle available with the name of 'asterisk' (check res_odbc.conf)

but all the database configurations seem to be correct and it works when I run the asterisk on a local machine without running on the docker container. same configurations I moved to the docker volume and now its not seem to work.

full error message:

[2023-08-23 11:54:29] ERROR[654]: res_config_odbc.c:200 realtime_odbc: No database handle available with the name of 'asterisk' (check res_odbc.conf)
[2023-08-23 11:54:29] DEBUG[654]: res_odbc.c:1027 odbc_obj_connect: Connecting asterisk(0x7f2bc93e51a0)
[2023-08-23 11:54:29] WARNING[654]: 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

Much appreciate your answers on this matter, Thanks

It means that you do not have a database handle with the name asterisk. There’s likely something wrong with your ODBC configuration and that is neither related to Asterisk nor Docker.

The thing is it works when I run asterisk on the local machine, but when I run it on the docker with the same cofigurations, its throwing this error

Do you have the same software installed on the local machine, and in the container? If not, check all dependencies, eg. correct ODBC settings in Asterisk, the drivers being made available and configured correctly in unixodbc etc.

Also, by default all the configuration on your local machine, needs to be copied to your container when you build it. Make sure all files required are copied to the container, and they are in the correct location.

There’s not enough information to diagnose your problem. I rarely work with containers so I can’t say much about the specifics of docker networking or whether there is a problem with the PostgreSQL socket that may or may not be available inside the container. I don’t know whether your configuration uses the default socket.

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