Summary:ASTERISK-21811: cdr_odbc "CDR direct execute failed" Not working with MySQL Master Server
Reporter:Emiliano (elmemis)Labels:
Date Opened:2013-05-23 10:43:23Date Closed:2013-05-23 20:46:19
Versions:11.2.2 Frequency of
Environment:Debian Squeeze, MySQL Server 5.5 (Master), Asterisk 11.2 Debian Wheezy, MySQL Server 5.5 (Slave).Attachments:( 0) cdr_odbc.conf
( 1) error.txt
( 2) res_odbc.conf
Description:The ODBC connection is working properly. If the MySQL server is not configured as master works fine, but when you activate master option stop working.
The replica is working properly. For example I execute SQLQuery in mysql or isql and work fine but at same time CDR not work.

MySQL Server configure character is utf8 and DB and tables are InnoDB.

      > cdr_odbc: Error in ExecDirect: -1
[May 23 12:33:45] WARNING[30318][C-00000036]: res_odbc.c:608 ast_odbc_direct_execute: SQL Execute error! Verifying connection to local [MySQL-Local]...
      > cdr_odbc: Error in ExecDirect: -1
[May 23 12:33:45] ERROR[30318][C-00000036]: cdr_odbc.c:163 odbc_log: CDR direct execute failed
Comments:By: Rusty Newton (rnewton) 2013-05-23 16:13:56.912-0500

Please read through https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines

Your report may not include enough information.

Please follow the instructions at this link: https://wiki.asterisk.org/wiki/display/AST/Collecting+Debug+Information and then attach the debug as .txt files to this issue with (More Actions > Attach Files).

Attach the relevant dialplan that was executed as well as your res_odbc and cdr_odbc configuration (minus any private information of course).

cdr_odbc is covered under extended support and therefore is supported by the community. Response times may reflect that. Patches are welcome if you are able to track the issue down.

By: Emiliano (elmemis) 2013-05-23 17:07:16.254-0500

Requested files.

By: Michael L. Young (elguero) 2013-05-23 17:50:01.961-0500


You have an error in cdr_odbc.conf.

According to res_odbc.conf, the dsn in your odbc.ini is MySQL-Local, not local.

cdr_odbc.conf does not use the settings in res_odbc.conf.  I believe cdr_odbc makes its own direct connection to odbc.

By: Emiliano (elmemis) 2013-05-23 19:37:31.810-0500

Change the parameter and now I get the following error:
ERROR[365][C-00000002]: cdr_odbc.c:149 odbc_log: Unable to retrieve database handle.  CDR failed.

By: Emiliano (elmemis) 2013-05-23 19:45:46.206-0500

Sorry, but all the guides said to use the settings that you put in res_odbc. If you put another DSN is not in res_odbc gives the error above.

Sorry my bad english.

By: Emiliano (elmemis) 2013-05-23 20:03:52.844-0500

I add this options in res_odbc.conf and work fine (Master server and Slave server):
share_connections => yes
sanitysql => select 1
isolation => repeatable_read

Thanks for yours help.

By: Michael L. Young (elguero) 2013-05-23 20:29:02.620-0500


So, we can close this out then?

By: Emiliano (elmemis) 2013-05-23 20:35:02.378-0500

Yes, you can.
One question, why the error occurs with IsolationLevel = read_comitted?

By: Michael L. Young (elguero) 2013-05-23 20:45:54.193-0500


I am not sure.  This is what MySQL docs state about the different levels: http://dev.mysql.com/doc/refman/5.5/en/set-transaction.html#isolevel_repeatable-read