<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hello,</p>
<p>if you use sqlops module, one connection is created at startup.</p>
<p>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:</p>
<p>global dbcon = 0;</p>
<p>if(dbcon == 0) {</p>
<p> // connect to db</p>
<p> dbcon = 1;<br>
</p>
<p>}<br>
</p>
This is just pseudo-code to show the logic, not specific to any
scripting language.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<div class="moz-cite-prefix">On 31.03.18 10:28, Igor Olhovskiy
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:2b8f2a17-f5ec-42e2-97b7-343def23921d@Spark">
<title></title>
<div name="messageBodySection" style="font-size: 14px;
font-family: -apple-system, BlinkMacSystemFont, sans-serif;">Hi!
<div><br>
</div>
<div>Is there any suggestions, best practices of using SQL
connections in KEMI?</div>
<div>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?</div>
<div><br>
</div>
<div>Or maybe use some else technique?</div>
</div>
<div name="messageSignatureSection" style="font-size: 14px;
font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br>
Regards, Igor</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - April 16-18, 2018, Berlin - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - May 14-16, 2018 - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
</body>
</html>