Unixodbc, asterisk and mysql

I having problems configuring the asterisk realtime. I don’t know If I have setup my odbc correctly. I having errors when I execute “isql -v” The error as it follows.
"[IM010][unixODBC][Driver Manager]Data source name too long
[ISQL]ERROR: Could not SQLConnect"

When trying to login in asterisk CLI, I executed a command “odbc show” and resulted into errors again.
"odbc show
Name: asterisk
DSN: asterisk
Connected: no

Sep 30 19:03:06 WARNING[11648]: res_odbc.c:238 odbc_sanity_check: Connection is down attempting to reconnect…
Sep 30 19:03:06 WARNING[11648]: res_odbc.c:499 odbc_obj_disconnect: res_odbc: asterisk [asterisk] already disconnected
Sep 30 19:03:06 NOTICE[11648]: res_odbc.c:554 odbc_obj_connect: Connecting asterisk
Sep 30 19:03:06 WARNING[11648]: res_odbc.c:565 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified"

Below are the configs the I have.

; odbc.ini

Driver = /usr/local/lib/libmyodbc3.so
Description = MyODBC 3.51 Driver DSN
SERVER = localhost
USER = astiadm
Password = imx1015
Database = voip_db


[MySQL ODBC Driver]
DRIVER = /usr/local/lib/libmyodbc3.so
SETUP = /usr/local/lib/libmyodbc3S.so
UsageCount = 1

How will I check If I have a successfully installtion of unixodbc?I did not use any gui during the installtion of unixodbc. Please advise. I’m really a newbie on this one.

Best regards,

It seems that your ODBC connection is not working. If you cannot connect with isql, then there is no way Asterisk will be able to connect. Make sure that you can use isql to connect to your database before you proceed.

Here’s my setup I’m using Ubuntu. This is my driver ini file.

Description = MySQL ODBC MyODBC Driver
Driver = /usr/lib/odbc/libmyodbc.so
Setup = /usr/lib/libodbcmyS.so

Make sure the driver and setup options are to the location of those files on your system. This is my DSN ini file

Description = MySQL ODBC For Asterisk
Trace = Yes
TraceFile = /tmp/odbc.log
Driver = MySQL
Server = ip_addr
User = dbuser
Password = secret
Port = 3306
Database = name

You need to install the driver first, use this command

sudo odbcinst -i -d -f driver.ini

Then install the DSN, use this command

sudo odbcinst -i -s -l -f dsn.ini

This will install a system DSN, which is in my opinion the easiest way to do things.

The test using isql.

isql asterisk dbuser secret