3

I want to write a C++ administrative app to simplify management of DBs I am in charge of. Currently, when I want to tell if there are users connected to multiple Firebird databases operated by 2 different instances of it, I have to connect to every single DB and check. That's ok, but I don't want to register every new database that is being created when i don't look, I want some way to list databases that are currently open or otherwise in use by the server. Current 2 uses of this functionality I can think of are:

  1. Auto-inclusion in backup procedure
  2. Application update, which require users to log off (one-look and I would be able to tell whom to kick or at least which department to call)
Kitet
  • 855
  • 1
  • 10
  • 20

1 Answers1

2

Firebird does not have an API to list all available databases. Technically Firebird simply doesn't know about the existence of a database until you actually connect to it.

You might be able to find all databases that are being connected to using the Trace API or the monitoring tables, but that does not exclude the possibility that other databases exist on your system.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • I know firebird doesn't know, but great suggestion about this Audit/Trace. That's exactly what i was looking for - user initiated on-demand traces are possible. I was able to use FBTRACEMGR with simple configuration file ` enabled true log_connections true ` to get all the information I need. Any database being connected to by someone get's listed. Knowing this, I will write an app that collect this information and stores it for future use (I think I can even check how often DBs are being used). Thanks, Mark! – Kitet Feb 20 '13 at 16:50
  • @Kitet You're welcome. Just a note: AFAIK only the SYSDBA user (or users with RDB$ADMIN role) can trace connections from other users. – Mark Rotteveel Feb 20 '13 at 17:05
  • Yes, they're MY servers and the tool I am about to build is for admins like my humble self =) – Kitet Feb 20 '13 at 17:11