[SR-Users] KEMI and SQL - best practices

Daniel-Constantin Mierla miconda at gmail.com
Mon Apr 2 08:20:51 CEST 2018


Hello,

if you use sqlops module, one connection is created at startup.

If you want to use the scripting language libs to connect to db, then
you can rely on a global variable to do the connection only first time
is needed, like:

global dbcon = 0;

if(dbcon == 0) {

   // connect to db

   dbcon = 1;

}

This is just pseudo-code to show the logic, not specific to any
scripting language.

Cheers,
Daniel

On 31.03.18 10:28, Igor Olhovskiy wrote:
> Hi!
>
> Is there any suggestions, best practices of using SQL connections in KEMI?
> Main idea - not to open connection to database in every route (cause
> it’s really expensive operation in terms of time) and reuse existing,
> for ex, created in some kind of startup route?
>
> Or maybe use some else technique?
>
> Regards, Igor
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com
Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20180402/2e2c17b5/attachment.html>


More information about the sr-users mailing list