Test with UIB components: if Firebird database connection is alive?

367 Views Asked by At

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.

0

There are 0 best solutions below