I&#39;&#39;ve only tested it with firebird on windows. As you said, your driver name doesnt match any of the names I used to detect if it&#39;s firebird.<br><br>The problem is that most databases supports &quot;SELECT 1&quot; as a query. It will always be successful if the the connection is up. However, firebird did not support &quot;SELECT 1&quot; and therefore i did query the system database instead.<br>
<br>If the firebird check fails, it will try to invoke &quot;SELECT 1&quot;, and on firebird that query will fail. And the failure is interpreted as the connection is down, and therefore it tries to reconnect.<br><br>That&#39;s probably why you get that error. If you have any other idea on how I can detect if it&#39;s a firebird db, please let me know and i&#39;ll fix the odbc code.<br>
<br><div class="gmail_quote">On Feb 19, 2008 1:05 PM, David Revill &lt;<a href="mailto:davidrevill@datarun.co.uk">davidrevill@datarun.co.uk</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">






<div bgcolor="#ffffff">
<div><font face="Arial" size="2">That&#39;s a fair point, but db_is_up is only called in 
2 places and the attempted re-connect could be done if the exec&#39;d query fails. 
That way it would not be dependant on the name of the driver.</font></div>
<div><font face="Arial" size="2"></font>&nbsp;</div>
<div><font face="Arial" size="2">In my application, the database was queried at the 
beginning of the script and the connection closed. It was explicitly 
re-connected at the end to post data, so the connection timeout was not an 
issue.</font></div>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;"><div class="Ih2E3d">
  <div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">----- Original Message ----- </div>
  <div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b> 
  <a title="jonas.gauffin@gmail.com" href="mailto:jonas.gauffin@gmail.com" target="_blank">Jonas 
  Gauffin</a> </div>
  <div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b> <a title="freeswitch-users@lists.freeswitch.org" href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a> 
  </div></div><div><div></div><div class="Wj3C7c">
  <div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b> Tuesday, February 19, 2008 10:35 
  AM</div>
  <div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b> Re: [Freeswitch-users] 
  Spidermonkey ODBC</div>
  <div><br></div>I did that code a couple of months ago.<br>The function was 
  added since connections are closed if they are idle too long, and they were 
  not reconnected again if that happened.<br><br><br>
  <div class="gmail_quote">On Feb 19, 2008 11:22 AM, David Revill &lt;<a href="mailto:davidrevill@datarun.co.uk" target="_blank">davidrevill@datarun.co.uk</a>&gt; 
  wrote:<br>
  <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div bgcolor="#ffffff">
    <div><font face="Arial" size="2">The problem is in switch_odbc.c function 
    db_is_up. It assumes that the variable is_firebird is true, but the setting 
    of this variable assumes that the Firebird driver name has &#39;FIREBIRD&#39;, 
    &#39;FB64&#39; or &#39;FB32&#39; in it.</font></div>
    <div><font face="Arial" size="2"></font>&nbsp;</div>
    <div><font face="Arial" size="2">I commented out &nbsp;the code in 
    db_is_up&nbsp;and just returned a true value, as on closer inspection could 
    not see the point of this function.</font></div><font color="#888888">
    <div><font face="Arial" size="2"></font>&nbsp;</div>
    <div><font face="Arial" size="2">David Revill</font></div></font>
    <blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
      <div>
      <div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">----- 
      Original Message ----- </div>
      <div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b> 
      <a title="davidrevill@datarun.co.uk" href="mailto:davidrevill@datarun.co.uk" target="_blank">David Revill</a> </div>
      <div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b> 
      <a title="freeswitch-users@lists.freeswitch.org" href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a> </div></div>
      <div>
      <div></div>
      <div>
      <div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b> 
      Tuesday, February 19, 2008 8:58 AM</div>
      <div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b> 
      Re: [Freeswitch-users] Spidermonkey ODBC</div>
      <div><br></div>
      <div><font face="Arial" size="2">I spotted this error a few months ago, and to 
      my shame did not let everyone know.&nbsp; I have since archived the 
      project so cannot point you to the actual code. However, the problem 
      is&nbsp; that it assumes the name of the Firebird Driver (FB64?)&nbsp; to 
      set a boolean, so that it handle the connection test 
      differently.</font></div>
      <div><font face="Arial" size="2"></font>&nbsp;</div>
      <div><font face="Arial" size="2">When looking at the actual code, I actually 
      felt that the connection test was redundant, as all it did was a select 
      from a system table. This meant it was doing two queries for everyone 
      required. (One to see if it could do a query, and then one to do it). I 
      therefore commented the connection test function out.</font></div>
      <div><font face="Arial" size="2"></font>&nbsp;</div>
      <div><font face="Arial" size="2">regards</font></div>
      <div><font face="Arial" size="2"></font>&nbsp;</div>
      <div><font face="Arial" size="2">David Revill</font></div>
      <blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
        <div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">----- 
        Original Message ----- </div>
        <div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b> 
        <a title="steven.brown@justfone.com" href="mailto:steven.brown@justfone.com" target="_blank">Steven Brown</a> 
        </div>
        <div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b> 
        <a title="freeswitch-users@lists.freeswitch.org" href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a> </div>
        <div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b> 
        Monday, February 18, 2008 11:34 PM</div>
        <div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Subject:</b> 
        [Freeswitch-users] Spidermonkey ODBC</div>
        <div><br></div>
        <div><font color="#000000" face="Arial" size="2">Hi,</font></div>
        <div><font face="Arial" size="2"></font>&nbsp;</div>
        <div><font face="Arial" size="2">I&#39;m experimenting with 
        spidermonkey&nbsp;for JavaScript call control, the basics seem fine and 
        I&#39;m now trying to connect to an existing Firebird database, the Firebird 
        odbc lib is installed ok as is unixODBC and I can confirm this and 
        access the db no problem with isql, something strange happens though 
        when I connect in spidermonkey, basically the odbc connection is made 
        successfully, but then as soon as I call either exec or query the odbc 
        connection starts to drop and re-connect continuously, </font></div>
        <div><font face="Arial" size="2"></font>&nbsp;</div>
        <div><font face="Arial" size="2">the isql output is below </font></div>
        <div><font face="Arial" size="2"></font>&nbsp;</div>
        <div><font face="Arial" size="2">isql -v 
        test<br>+---------------------------------------+<br>| 
        Connected!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        |<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        |<br>| 
        sql-statement&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        |<br>| help 
        [tablename]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        |<br>| 
        quit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        |<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        |<br>+---------------------------------------+<br>SQL&gt; select first 1 
        * from pool_phones<br>+---------------------+------------+<br>| 
        GSMNO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        | ORGNO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        |<br>+---------------------+------------+<br>| 
        0712345678&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 
        1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        |<br>+---------------------+------------+<br>SQLRowCount returns 1<br>1 
        rows fetched<br>SQL&gt;<br></font></div>
        <div><font face="Arial" size="2">however the following test code calling the 
        same query</font></div>
        <div><font face="Arial" size="2"></font>&nbsp;</div>
        <div><font face="Arial" size="2">use(&quot;ODBC&quot;);</font></div>
        <div><font face="Arial" size="2">var db = new 
        ODBC(&quot;test&quot;,&quot;SYSDBA&quot;,&quot;masterkey&quot;);<br>db.connect();<br>db.query(&quot;select 
        first 1 *&nbsp; from pool_phones&quot;);</font></div>
        <div><font face="Arial" size="2">db.nextRow();</font></div>
        <div><font face="Arial" size="2">row = 
        db.getData();<br>console_log(&quot;INFO&quot;,&quot;HELLO &quot; +&nbsp; row[&quot;GSMNO&quot;] 
        &nbsp;+ &quot;\n&quot;);</font></div>
        <div><font face="Arial" size="2">exit();</font></div>
        <div><font face="Arial" size="2"></font>&nbsp;</div>
        <div><font face="Arial" size="2">gives the following output and then just 
        loops disconnecting and reconnecting until I shutdown 
        freeswitch<br></font></div>
        <div><font face="Arial" size="2">2008-02-18 23:26:03 [DEBUG] 
        switch_core_state_machine.c:144 switch_core_standard_on_execute() 
        </font><a href="mailto:sofia/default/1000@192.168.0.7:5060" target="_blank"><font face="Arial" size="2">sofia/default/1000@192.168.0.7:5060</font></a><font face="Arial" size="2"> Execute javascript(/usr/scripts/test1.js)<br>
2008-02-18 23:26:03 
        [DEBUG] mod_spidermonkey.c:3150 js_api_use() Loading ODBC<br>2008-02-18 
        23:26:03 [DEBUG] switch_odbc.c:145 switch_odbc_handle_connect() 
        Connecting test<br>2008-02-18 23:26:03 [DEBUG] switch_odbc.c:174 
        switch_odbc_handle_connect() Connected to [test]<br>2008-02-18 23:26:03 
        [DEBUG] switch_odbc.c:95 switch_odbc_handle_disconnect() Disconnected 0 
        from [test]<br>2008-02-18 23:26:03 [DEBUG] switch_odbc.c:142 
        switch_odbc_handle_connect() Re-connecting test<br>2008-02-18 23:26:03 
        [DEBUG] switch_odbc.c:145 switch_odbc_handle_connect() Connecting 
        test<br>2008-02-18 23:26:03 [DEBUG] switch_odbc.c:174 
        switch_odbc_handle_connect() Connected to [test]<br>2008-02-18 23:26:03 
        [CRIT] switch_odbc.c:234 db_is_up() The sql server is not responding for 
        DSN test []<br>2008-02-18 23:26:03 [INFO] switch_odbc.c:239 db_is_up() 
        The connection has been re-established</font></div>
        <div><font face="Arial" size="2">...</font></div>
        <p><font face="Arial" size="2">Any ideas much appreciated</font></p>
        <p><font face="Arial" size="2">Thanks</font></p>
        <p><font face="Arial" size="2">Steve</font></p>
        <p><font face="Arial" size="2"></font>&nbsp;</p>
        <p><font face="Arial" size="2"></font>&nbsp;</p>
        <p><font face="Arial" size="2"></font>&nbsp;</p>
        <p><font face="Arial" size="2"></font>&nbsp;</p>
        <div><br><br></div>
        <div><font face="Arial" size="2"></font>&nbsp;</div>
        <div><font face="Arial" size="2"></font>&nbsp;</div>
        <div><font face="Arial" size="2"></font>&nbsp;</div>
        <div><font face="Arial" size="2"></font>&nbsp;</div>
        <p></p>
        <hr>

        <p></p>_______________________________________________<br>Freeswitch-users 
        mailing list<br><a href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote>
      <p></p>
      <hr>

      <p></p>_______________________________________________<br>Freeswitch-users 
      mailing list<br><a href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br>_______________________________________________<br>Freeswitch-users 
    mailing list<br><a href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>
  </div></div><p>
  </p><hr><div class="Ih2E3d">

  <p></p>_______________________________________________<br>Freeswitch-users 
  mailing 
  list<br><a href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></blockquote></div>
<br>_______________________________________________<br>Freeswitch-users mailing list<br><a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>