[asterisk-users] Best way to connect to a MySQL Database

Steve Edwards asterisk.org at sedwards.com
Mon Nov 15 18:32:21 CST 2010


On Mon, 15 Nov 2010, Matt Darnell wrote:

> Is this command the best way to access a MySQL database
> - MYSQL(Connect connid dhhost dbuser dbpass dbname) ?
>
> I thought I heard that using ODBC was a bit more stable.

I prefer to access MySQL using an AGI to access the database and set 
channel variables.

I think database access in the dialplan is 'ugly.'

I confess I've never done it, but if you search back through the list 
archives, you've find examples that must have taken forever to figure out 
all the quoting cruft.

I like wrapping up the database cruft in a nice and tidy little box. It 
makes for a much more readable and maintainable dialplan.

Also, you won't have your database credentials on display and you'll have 
full access to the database features and error return codes.

I write my AGIs in C so the impact is insignificant.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list