Matt Darnell
2010-Nov-15 23:04 UTC
[asterisk-users] Best way to connect to a MySQL Database
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. Anyone have any experience? Thanks, Matt
Steve Edwards
2010-Nov-16 00:32 UTC
[asterisk-users] Best way to connect to a MySQL Database
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
Leif Madsen
2010-Nov-16 00:38 UTC
[asterisk-users] Best way to connect to a MySQL Database
On 10-11-15 06:04 PM, 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. > > Anyone have any experience?Use func_odbc along with res_odbc. I've taken dialplans for customers who were having issues with MYSQL() and had about 9 lines of dialplan compressed down to 1 line of dialplan for the call, with much greater stability. Some information about that here: http://astbook.asteriskdocs.org/en/2nd_Edition/asterisk-book-html-chunk/asterisk-CHP-12.html And here: http://ofps.oreilly.com/titles/9780596517342/ch15.html (The second link is to the 3rd edition of the Asterisk book, currently being written, so this is a preview of the text in rough draft form.) Leif.
Nile Kaledon
2010-Nov-16 17:03 UTC
[asterisk-users] Best way to connect to a MySQL Database
As I know there are sevearl ways to access MySQL database. The easiest way is to use Agi server but you can also use Asterisk addons or some other approach. Because I'm Visual Dialplan user I prefer Agi option and I use Integration Server (Agi server) for database access. It is easy, one block (one line of code) and you can execute SQL query. Here is some information you may find useful: http://codezone.apstel.com/tiki-index.php?page=Work+with+MS+SQL+or+MySQL+or+Sybase+or+any+other+database+in+Asterisk+dial+plan and here: http://codezone.apstel.com/tiki-index.php?page=Work+with+MySQL+in+Asterisk+dial+plan+using+Asterisk+addons Nile -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20101116/7f09019b/attachment.htm
Matt Darnell
2010-Nov-16 20:31 UTC
[asterisk-users] Best way to connect to a MySQL Database
On Mon, Nov 15, 2010 at 1:04 PM, Matt Darnell <mattdarnell at gmail.com> 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. > > Anyone have any experience? > > Thanks, > Matt >Thank you everyone for the tips! -Matt