<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16609" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>One way to detect firebird would be to put the
'Select first 1 * from RDB$relations' into switch_odbc_handle_connect. If
it succeeds then it is Firebird. A better query might be 'select * from
rdb$database' as the system table rdb$database only ever has 1
record.</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=jonas.gauffin@gmail.com href="mailto:jonas.gauffin@gmail.com">Jonas
Gauffin</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=freeswitch-users@lists.freeswitch.org
href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, February 19, 2008 12:18
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Freeswitch-users]
Spidermonkey ODBC</DIV>
<DIV><BR></DIV>I''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's
firebird.<BR><BR>The problem is that most databases supports "SELECT 1" as a
query. It will always be successful if the the connection is up. However,
firebird did not support "SELECT 1" and therefore i did query the system
database instead.<BR><BR>If the firebird check fails, it will try to invoke
"SELECT 1", 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's probably why you get that error. If you have any
other idea on how I can detect if it's a firebird db, please let me know and
i'll fix the odbc code.<BR><BR>
<DIV class=gmail_quote>On Feb 19, 2008 1:05 PM, David Revill <<A
href="mailto:davidrevill@datarun.co.uk">davidrevill@datarun.co.uk</A>>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV bgcolor="#ffffff">
<DIV><FONT face=Arial size=2>That'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'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> </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="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV class=Ih2E3d>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal">-----
Original Message ----- </DIV>
<DIV
style="BACKGROUND: rgb(228,228,228) 0% 50%; FONT: 10pt arial; font-size-adjust: none; font-stretch: normal; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"><B>From:</B>
<A title=jonas.gauffin@gmail.com href="mailto:jonas.gauffin@gmail.com"
target=_blank>Jonas Gauffin</A> </DIV>
<DIV
style="FONT: 10pt arial; 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: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Sent:</B>
Tuesday, February 19, 2008 10:35 AM</DIV>
<DIV
style="FONT: 10pt arial; 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 <<A
href="mailto:davidrevill@datarun.co.uk"
target=_blank>davidrevill@datarun.co.uk</A>> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<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="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal">-----
Original Message ----- </DIV>
<DIV
style="BACKGROUND: rgb(228,228,228) 0% 50%; FONT: 10pt arial; font-size-adjust: none; font-stretch: normal; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"><B>From:</B>
<A title=davidrevill@datarun.co.uk
href="mailto:davidrevill@datarun.co.uk" target=_blank>David Revill</A>
</DIV>
<DIV
style="FONT: 10pt arial; 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: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Sent:</B>
Tuesday, February 19, 2008 8:58 AM</DIV>
<DIV
style="FONT: 10pt arial; 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="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal">-----
Original Message ----- </DIV>
<DIV
style="BACKGROUND: rgb(228,228,228) 0% 50%; FONT: 10pt arial; font-size-adjust: none; font-stretch: normal; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"><B>From:</B>
<A title=steven.brown@justfone.com
href="mailto:steven.brown@justfone.com" target=_blank>Steven
Brown</A> </DIV>
<DIV
style="FONT: 10pt arial; 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: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Sent:</B>
Monday, February 18, 2008 11:34 PM</DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Subject:</B>
[Freeswitch-users] Spidermonkey ODBC</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial color=#000000 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"
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>
<P>
<HR>
<P></P>_______________________________________________<BR>Freeswitch-users
mailing
list<BR>Freeswitch-users@lists.freeswitch.org<BR>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<BR>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<BR>http://www.freeswitch.org<BR></BLOCKQUOTE></BODY></HTML>