Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Check if DB is running from remote location

0 views
Skip to first unread message

Pavel Karady

unread,
Oct 6, 2008, 1:41:15 PM10/6/08
to
Greetings chaps,

What's the best, most-proven-by-time way of checking if a database server is
running, from a remote location, from SQL? In SQL Anywhere 9.

We've thought of batch files (.bat) that will call dbisqlg and output the
result to file, but I'm looking for a solution that will not leave the SQL
environment of a database event. Can remote servers (CREATE SERVER) be used
for this purpose?

Thanks in advance for any comments.
Pavel


Chris Keating (Sybase iAnywhere)

unread,
Oct 6, 2008, 1:59:53 PM10/6/08
to
NodeAddress connection parameter should resolve this for you i.e.,
SELECT connection_property ( 'NodeAddress' ). If the client and server
are running on the same machine, it will be set to an empty string.
--

Chris Keating

****************************************
Please only post to the newsgroup

SQL Anywhere Developer Community
http://www.sybase.com/developer/library/sql-anywhere-techcorner
SQL Anywhere Blog Center
http://www.sybase.com/sqlanyblogs
Maintenance releases and EBFs
http://downloads.sybase.com/swx/sdmain.stm
Use Case Express to report bugs
http://case-express.sybase.com

Breck Carter [TeamSybase]

unread,
Oct 7, 2008, 8:42:39 AM10/7/08
to
Here is the pseudo-code that the Foxhound monitor uses from inside an
event:

BEGIN
SELECT dummy_col INTO @dummy_col FROM proxy_DUMMY;
EXCEPTION WHEN OTHERS THEN
SET @connected_ok = 'N';
END;
BEGIN
IF @connected = 'N' THEN
ALTER SERVER S USING '...';
END IF;
EXCEPTION WHEN OTHERS THEN
...cannot connect!
END;

The first SELECT tests the remote server connection, which may be OK.
If the SELECT fails, the remote server may be gone, OR it may be up
and running again after the proxy connection was lost for a while. The
ALTER SERVER is an attempt to re-connect, and if that fails, it is
safe to assume the remote server is gone.

Breck

On 6 Oct 2008 10:41:15 -0700, "Pavel Karady"
<firstname.lastname@nospam_kogerusa.com> wrote:

--
Breck Carter http://sqlanywhere.blogspot.com/

RisingRoad SQL Anywhere and MobiLink Professional Services
breck....@risingroad.com

Pavel Karady

unread,
Oct 8, 2008, 4:47:59 AM10/8/08
to
Thanks Chris and Breck,

I will search up the NodeAddress method, however client and the server are
not running on the same machine, so we will probably aim for Breck's ALTER
SERVER reconnecting exception catching method.

Thanks guys, appreciated
Pavel

"Breck Carter [TeamSybase]" <NOSPAM__br...@gmail.com> wrote in
message news:o4mme4t1476j70001...@4ax.com...

0 new messages