<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <br>
    <div class="moz-cite-prefix">On 05/04/16 14:18, Paul Smith wrote:<br>
    </div>
    <blockquote
      cite="mid:0DA2C6AA-CDFA-40C9-83A9-325BB73B329E@claritytele.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <div>Hi Jon,</div>
      <div>The normal way would be to use multiple modparam lines, one
        for each of your databases.  Then in your route config you can
        select and use any of those connections:</div>
      <div><br>
      </div>
      <div><a moz-do-not-send="true"
href="http://kamailio.org/docs/modules/4.4.x/modules/sqlops.html#idm20488">http://kamailio.org/docs/modules/4.4.x/modules/sqlops.html#idm20488</a></div>
      <div><br>
      </div>
      <div>
        <pre class="programlisting" style="border: 1px solid rgb(153, 204, 204); padding-left: 15pt; widows: 1; background-color: rgb(254, 254, 238); position: static; z-index: auto;">modparam("sqlops","sqlcon","cb=><a moz-do-not-send="true" href="mysql://kamailio:abc@10.10.1.1/testdb">mysql://kamailio:abc@10.10.1.1/testdb</a>")
modparam("sqlops","sqlcon","ca=><a moz-do-not-send="true" href="dbdriver://username:password@dbhost/dbname">dbdriver://username:password@dbhost/dbname</a>")
...</pre>
      </div>
      <div>
        <pre class="programlisting" style="border: 1px solid rgb(153, 204, 204); padding-left: 15pt; widows: 1; background-color: rgb(254, 254, 238); position: static; z-index: auto;">...
sql_query("ca", "select * from domain", "ra");
xlog("number of rows in table domain: $dbr(ra=>rows)\n");
sql_result_free("ra");</pre>
        <div>In your case you might set some variable in the route to
          select the relevant connection name from your pre-defined
          list, and then pass that variable to the sql_query() function
          call.</div>
      </div>
      <div><br>
      </div>
      <div>I think you wanted to have one connection to the database
        server, and then have function calls to query a database on that
        server … as far as I know that is not possible.</div>
    </blockquote>
    <br>
    Indeed the database url would expect a database name, iirc. However,
    if it is the same username and password for both databases, it might
    work. I haven't tried, but in mysql, if I did 'use database x', I
    can still do queries to another database by prefixing the table
    names with the database name, like 'select * from y.test'.<br>
    <br>
    The easiest way to figure out is to make a test with sql_query()
    doing "select * from y.table ..." through a connection to database
    x.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <blockquote
      cite="mid:0DA2C6AA-CDFA-40C9-83A9-325BB73B329E@claritytele.com"
      type="cite"><br>
      <div apple-content-edited="true">
        <div style="color: rgb(0, 0, 0); font-family: Helvetica;
          font-size: 12px; font-style: normal; font-variant: normal;
          font-weight: normal; letter-spacing: normal; line-height:
          normal; orphans: auto; text-align: start; text-indent: 0px;
          text-transform: none; white-space: normal; widows: auto;
          word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap:
          break-word; -webkit-nbsp-mode: space; -webkit-line-break:
          after-white-space;"><br>
        </div>
      </div>
      <div>
        <div>On 5 Apr 2016, at 12:57, Jon Bonilla (Manwe) <<a
            moz-do-not-send="true" href="mailto:manwe@aholab.ehu.es"><a class="moz-txt-link-abbreviated" href="mailto:manwe@aholab.ehu.es">manwe@aholab.ehu.es</a></a>>
          wrote:</div>
        <br class="Apple-interchange-newline">
        <blockquote type="cite">Hi all<br>
          <br>
          I have multiple auth credentials split among multiple
          databases (same server).<br>
          I want to extract the password from the correct database for
          each request and<br>
          pass it as arameter to the auth functions.<br>
          <br>
          The problem is, how can I use sqlops and select the correct
          database in<br>
          realtime? the db connection already contains the database to
          connect to. <br>
          <br>
          Would it if I use a default connection but I put the db I want
          i the query?<br>
          Something like:<br>
          <br>
          select * from database.table ...<br>
          select * from $avp(s:database).table where i=1...<br>
          <br>
          <br>
          <br>
          cheers,<br>
          <br>
          Jon<br>
          <br>
          _______________________________________________<br>
          SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
          mailing list<br>
          <a moz-do-not-send="true"
            href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
          <a moz-do-not-send="true"
            href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
        </blockquote>
      </div>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.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-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, Berlin, May 18-20, 2016 - <a class="moz-txt-link-freetext" href="http://www.kamailioworld.com">http://www.kamailioworld.com</a></pre>
  </body>
</html>