Search code examples
databasefirebird

Get connected clients IP in Firebird


I have a Firebird database hosted on a server. Firebird can display a list of connected users, with username, role etc, with the MON$ATTACHMENTS table. But, I can't find out how to get IP address of one specific client.

Exemple : if the user "USER", from 192.168.1.77, is connected on 192.168.1.2 (server), how can I get this 192.168.1.77 address with Firebird query ?

Edit : MON$REMOTE_ADDRESS shows the DHCP server address, not the local client one.


Solution

  • Firebird has an internal attachements table, where every current connection is stored. The remote address(es) for a user named USER can be queried like this:

    select MON$REMOTE_ADDRESS
      from MON$ATTACHMENTS
      where MON$USER = 'USER'