Asterisk connection to database

i have made a dial plan to connect to mysql database using the command:

it works for a small time but after that it can’t connect to this database and must restart asterisk to return back to work.

asterisk version

please help?

need more info, post the output of the CLI when it breaks.

simply, you have to disconnect the session from Mysql after doing the require query. Otherwise you will not able to connect again