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@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