Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread EDBSrvr running?
Wed, Mar 11 2009 10:39 AMPermanent Link

Uli Becker
What is the best way to check for a client-application if  EDBSrvr is
running or not?

Thanks. Uli
Wed, Mar 11 2009 11:06 AMPermanent Link

"James Relyea"
I don't know if either of these are the "best" or not, but they work.

1. It's pretty easy in .Net to query the running processes. You could get it
that way. I've not tried to check for running processes on remote machines
though. It has limits because even though the server could be running, it
would not verify it is stopped or accepting connections.
2. Another could be to attempt a known connection string, capture the
failure to connect error and take action. I always go with this route
because I'm confirming connectivity to a server running locally or on a
remote machine, confirming it is accepting connections, and validating the
users' log ins are correct. The downside is a lag for timeouts etc so I give
them a progress bar or something to distract them from the hourglass Smile

Smile
jr


"Uli Becker" <test@test.com> wrote in message
news:55FE3A89-D13B-4760-808A-46A47AAD0679@news.elevatesoft.com...
> What is the best way to check for a client-application if  EDBSrvr is
> running or not?
>
> Thanks. Uli

Wed, Mar 11 2009 12:01 PMPermanent Link

Uli Becker
James,

> 2. Another could be to attempt a known connection string, capture the
> failure to connect error and take action.

That's what I am doing at the moment. Just thought there must be
something like a "ping" without the timeout-lag you are describing.

Thanks. Uli
Wed, Mar 11 2009 2:13 PMPermanent Link

"James Relyea"
A ping is only going to tell you if the machine can be reached or not, and
it's not necessarily reliable. PC/Server firewalls, switches/routers can
disable ICMP traffic which blocks pings but will allow the DB connectivity.

On a more elaborate effort, you might be able to run the same connection
attempt in the app (maybe when it starts?) on a 2nd thread with a timer that
kills it if it takes too long. Say for argument sake, if the connection
thread takes more than 3 seconds then have the application kill the thread
and dispose of the resources. Or use a custom delegate to handle a timeout
event in the connection thread. The latter keeps the functionality with the
thread class instead of putting anything in the calling application.

I don't know if ElevateDB has a connection timeout parameter or not. If it
does, that might be a simpler way to accomplish the same. For some reason, I
think MS SQL connections time out after 30 seconds but that might be when
running commands while you are already connected; I'm not totally certain
though.

I hope some of this helps.

Smile
jr


"Uli Becker" <test@test.com> wrote in message
news:49B7E034.40103@test.com...
> James,
>
>> 2. Another could be to attempt a known connection string, capture the
>> failure to connect error and take action.
>
> That's what I am doing at the moment. Just thought there must be something
> like a "ping" without the timeout-lag you are describing.
>
> Thanks. Uli

Wed, Mar 11 2009 2:42 PMPermanent Link

Uli Becker
James,

> A ping is only going to tell you if the machine can be reached or not

Sure, that's why I wrote 'something like a "ping"'.

> I don't know if ElevateDB has a connection timeout parameter or not. If it
> does, that might be a simpler way to accomplish the same.
>...
> I hope some of this helps.

It did! Thank you.
Uli
Fri, Mar 13 2009 9:23 AMPermanent Link

"James Relyea"
The .Net ElevateDB data provider has a ConnectionTimeout property, and a
Timeout event built in. You might be able to use these and have a clean
simple solution maybe.

Smile
jr




"Uli Becker" <test@test.com> wrote in message
news:94749751-394D-4318-8806-A6A38229FC74@news.elevatesoft.com...
> James,
>
>> A ping is only going to tell you if the machine can be reached or not
>
> Sure, that's why I wrote 'something like a "ping"'.
>
>> I don't know if ElevateDB has a connection timeout parameter or not. If
>> it does, that might be a simpler way to accomplish the same. ...
>> I hope some of this helps.
>
> It did! Thank you.
> Uli
>

Fri, Mar 13 2009 11:19 AMPermanent Link

Uli Becker
James,
> The .Net ElevateDB data provider has a ConnectionTimeout property, and a
> Timeout event built in. You might be able to use these and have a clean
> simple solution maybe.

Thanks. I am using this code meanwhile:

try
    OpenTables;
    PrepareQueries;
  except
    on E: Exception do
    begin
      if (E is EDatabaseError) and (E is EEDBError) then
      begin
        if (EEDBError(E).ErrorCode = EDB_ERROR_CLIENTCONN) then
        begin
          Application.MessageBox('Es konnte keine Verbindung zum
Datenbankserver hergestellt werden.', global.titel, 16);
          application.Terminate;
        end
        else
        begin
          Application.MessageBox(PChar('Datenbankfehler # ' +
IntToStr(EEDBError(E).ErrorCode)), global.titel, 64);
          application.Terminate;
        end;
      end
      else
        Application.MessageBox('Unbekannter Datenbankfehler.',
global.titel, 16);
        application.Terminate;
    end;
  end;

Uli
Image