如何在Zabbix上使用unixODBC连接到ODBC DSN?

时间:2015-07-17 11:02:09

标签: mysql unixodbc

我安装了unixODBC和MySql ODBC驱动程序,但无法连接ODBC DNS。

isql -v myodbc_mysql_dsn

我收到了这个错误:

Cannot connect to ODBC DSN:
[SQL ERROR]:[IM002][0][[unixODBC][Driver Manager]Data source name not found, and no default driver specified]|

我的移民看起来像这样:

cat /etc/odbc.ini
[myodbc_mysql_dsn]
Description = test
Driver      = MySQL5                 # custom driver name
Server      = localhost                    # or external IP if needed
Port        = 3306                         # or custom port if needed
Socket      = /var/run/mysqld/mysqld.sock  # socket, see above
Database    = zabbix                     # MySQL DB name or empty
Option      = 3
ReadOnly    = No
cat /etc/odbcinst.ini
[MySQL5]
Description = ODBC for MySQL
Driver      = /usr/lib/odbc/libmyodbc5.so
Setup       = /usr/lib/odbc/libodbcmyS.so
#Driver     = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
#Setup      = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage   = 1 
UsageCount = 2 '

我该怎么办?

1 个答案:

答案 0 :(得分:0)

以下是一些提示: 使用:

odbcinst -q -s

查看您的驱动程序是否看到了您的数据源

然后

odbcinst -j

应该显示* .ini

的文件路径