0

In the old IBX components there was a function called 'TestConnected':

if not DB.TestConnected then
  Showmessage('Database connection dropped!');

I'm looking for a similar command under Unified InterBase component.
Checking if uDB.Connected = True ... does not give real proof.

Before executing an SQL command I would like to test, if the connection to the database is still up, so I:

  • don't need to execute a transaction if the connection isn't available
  • can inform the user about the problem
  • trying to re-connect, etc...

Why do I need this? I'm creating a background thread class to execute all SQL commands with timeout.

Only Firebird 4.0+ is able to handle timeout functions. Version 2.5 support only LockTimeout, so I'm forced to start all DB operations in a secondary thread which can be stopped, if running too long.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
SzakiLaci
  • 347
  • 1
  • 16
  • 1
    issue `select 1 from rdb$database` - and here you have your test – Arioch 'The Apr 07 '19 at 22:56
  • 1
    you can see `fb_ping` function in `TUIBaseLibrary` sources (and also in "new" API) if you compile UIB against Firebird 3.0, but that function seems to be neither exposed nor used. More so, the purpose is more likely to bother OS network stack and keep connection alive, rather than test it. – Arioch 'The Apr 07 '19 at 23:04

0 Answers0