<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hey,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Could you try replacing the @-sign in the username with: %40  (percent-forty)?</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">// Samuel</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> sr-users <sr-users-bounces@lists.kamailio.org> on behalf of Floimair Florian <f.floimair@commend.com><br>
<b>Sent:</b> Monday, November 27, 2017 3:33:21 PM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List<br>
<b>Subject:</b> [SR-Users] URL problems connecting to external (Azure) MySQL database</font>
<div> </div>
</div>
<style>
<!--
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
@font-face
        {font-family:Hack}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
a:x_link, span.x_MsoHyperlink
        {color:#0563C1;
        text-decoration:underline}
a:x_visited, span.x_MsoHyperlinkFollowed
        {color:#954F72;
        text-decoration:underline}
span.x_E-MailFormatvorlage17
        {font-family:"Calibri",sans-serif;
        color:windowtext}
.x_MsoChpDefault
        {font-family:"Calibri",sans-serif}
@page WordSection1
        {margin:70.85pt 70.85pt 2.0cm 70.85pt}
div.x_WordSection1
        {}
-->
</style>
<div lang="DE" link="#0563C1" vlink="#954F72">
<div class="x_WordSection1">
<p class="x_MsoNormal">Hi!</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal"><span lang="EN-US">I’m having troubles connecting Kamailio to an external MySQL database (on Microsoft Azure Cloud).</span></p>
<p class="x_MsoNormal"><span lang="EN-US">Initially creating the database with kamctl worked fine, but accessing it at runtime via db_url fails.</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US">A somewhat unusual thing about the connection to a MySQL database on Azure is that the username contains an ‘@’ character.</span></p>
<p class="x_MsoNormal"><span lang="EN-US">This leads me to believe that this case is somewhat unhandled when parsing the database URI.</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US">Trying to connect to something like</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US" style="font-size:10.0pt; font-family:Hack">modparam("sipcapture", "db_url", "mysql://user@clouddb:password@clouddb.mysql.database.azure.com/db")</span><span lang="EN-US"></span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal"><span lang="EN-US">Results in errors starting Kamailio</span></p>
<p class="x_MsoNormal"><span lang="EN-US"> </span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Hack; color:#CB4B16">ERROR: db_mysql [km_my_con.c:124]: db_mysql_new_connection(): driver error: Unknown MySQL server host 'clouddb' (-2)</span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Hack; color:#CB4B16">ERROR: <core> [db.c:318]: db_do_init2(): could not add connection to the pool</span></p>
<p class="x_MsoNormal"><span lang="EN-US" style="font-size:10.0pt; font-family:Hack; color:#CB4B16">ERROR: sipcapture [sipcapture.c:1146]: child_init(): unable to connect to database [mysql://user@clouddb:password@clouddb.mysql.database.azure.com/db] from capture_mode
 param.</span><span lang="EN-US"></span></p>
<p class="x_MsoNormal" style=""><span lang="EN-US" style="color:black">Is there a trick on how to achieve a connection in this case like some sort of escape character probably?</span></p>
<p class="x_MsoNormal" style=""><span lang="EN-US" style="font-size:10.0pt; font-family:"Arial",sans-serif; color:black"> </span><span lang="EN-US" style="font-size:12.0pt; font-family:"Times New Roman",serif"></span></p>
<p class="x_MsoNormal" style=""><span lang="EN-US" style="font-size:10.0pt; font-family:"Arial",sans-serif; color:black"> </span><span lang="EN-US" style="font-size:12.0pt; font-family:"Times New Roman",serif"></span></p>
<p class="x_MsoNormal" style=""><span lang="DE-AT" style="font-size:10.0pt; font-family:"Arial",sans-serif; color:black">Mit freundlichen Grüßen<br>
<br>
<b>Florian Floimair (IMS) 1568</b></span><span lang="DE-AT" style="font-size:12.0pt; font-family:"Times New Roman",serif"></span></p>
<p class="x_MsoNormal" style=""><span lang="DE-AT" style="font-size:12.0pt; font-family:"Times New Roman",serif"> </span></p>
<p class="x_MsoNormal"> </p>
</div>
</div>
</body>
</html>