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 <<a href="mailto:davidrevill@datarun.co.uk">davidrevill@datarun.co.uk</a>> 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 'FIREBIRD', 'FB64' or 'FB32'
in it.</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">I commented out the code in db_is_up 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> </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 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="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 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 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. I have since archived the project so
cannot point you to the actual code. However, the problem is that it
assumes the name of the Firebird Driver (FB64?) to set a boolean, so
that it handle the connection test differently.</font></div>
<div><font face="Arial" size="2"></font> </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> </div>
<div><font face="Arial" size="2">regards</font></div>
<div><font face="Arial" size="2"></font> </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> </div>
<div><font face="Arial" size="2">I'm experimenting with spidermonkey for
JavaScript call control, the basics seem fine and I'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> </div>
<div><font face="Arial" size="2">the isql output is below </font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">isql -v
test<br>+---------------------------------------+<br>|
Connected!
|<br>|
|<br>|
sql-statement
|<br>| help
[tablename]
|<br>|
quit
|<br>|
|<br>+---------------------------------------+<br>SQL> select first 1 *
from pool_phones<br>+---------------------+------------+<br>|
GSMNO
| ORGNO
|<br>+---------------------+------------+<br>|
0712345678 |
1
|<br>+---------------------+------------+<br>SQLRowCount returns 1<br>1 rows
fetched<br>SQL><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> </div>
<div><font face="Arial" size="2">use("ODBC");</font></div>
<div><font face="Arial" size="2">var db = new
ODBC("test","SYSDBA","masterkey");<br>db.connect();<br>db.query("select
first 1 * from pool_phones");</font></div>
<div><font face="Arial" size="2">db.nextRow();</font></div>
<div><font face="Arial" size="2">row =
db.getData();<br>console_log("INFO","HELLO " + row["GSMNO"] +
"\n");</font></div>
<div><font face="Arial" size="2">exit();</font></div>
<div><font face="Arial" size="2"></font> </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> </p>
<p><font face="Arial" size="2"></font> </p>
<p><font face="Arial" size="2"></font> </p>
<p><font face="Arial" size="2"> </font></p>
<div><br><br></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"></font> </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">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>