我有任务 - 将 CEL 事件写入 mysql。我写了下一个设置:
odbcinst.ini =>
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/i386-linux-gnu/odbc/libmyodbc.so
Setup = /usr/lib/i386-linux-gnu/odbc/libodbcmyS.so
FileUsage = 1
驱动程序也已定位。接下来是 /etc/odbc.ini - 连接到数据库。
[asterisk] # my system DSN
Description = description of your DSN
Driver = MySQL # custom driver name
Server = localhost
Port = 3306 # custom port
Socket = /var/run/mysqld/mysqld.sock # socket
Database = asteriskcdrdb # MySQL DB name
UserName = admin
Password = 123456
Option = 3
ReadOnly = No
当我使用“odbcinst -s -q”时,我得到
root@astes:~# odbcinst -s -q
[asterisk]
然后我相信系统看到了我的 dsn。但是当我使用“isql asterisk -v”时,我得到了
root@astes:~# isql asterisk -v
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect
我做错了什么?我安装了 mysql-connector 和 ODBC。
更新型多巴胺:当我在 CLI* 中使用“重新加载”时,我得到
[Feb 1 03:41:02] NOTICE[3135]: res_odbc.c:1481 odbc_obj_connect: Connecting asterisk
[Feb 1 03:41:02] WARNING[3135]: res_odbc.c:1508 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
[Feb 1 03:41:02] WARNING[3135]: res_odbc.c:1329 _ast_odbc_request_obj2: Failed to connect to asterisk
[Feb 1 03:41:02] WARNING[3135]: cel_odbc.c:125 load_config: No such connection 'asterisk' in the 'first' section of cel_odbc.conf. Check res_odbc.conf.
答案1
将驱动程序更改为最新版本,它就可以工作了。