0

I need to check, if the server I'm connecting to is local or an other PC on the LAN / VPN.
Using UIB API or SQL. (It's for data synchronization.)

Analyzing the connection string is impossible, since there are too many variation. (For example an alias, own pc name, IPv6, 127.0.0.3, ...)

select RDB$GET_Context('SYSTEM', 'CLIENT_ADDRESS'), 
       RDB$GET_Context('SYSTEM', 'DB_NAME') from RDB$DATABASE;

None of these gives back the Server IP, only the file location on the server.

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
SzakiLaci
  • 347
  • 1
  • 16
  • 1
    Related, possible duplicate: [How to get the servername\hostname in Firebird 2.5.x](https://stackoverflow.com/questions/54671178/) – Remy Lebeau Aug 10 '19 at 00:16
  • 1
    Possible duplicate of [How to get the servername\hostname in Firebird 2.5.x](https://stackoverflow.com/questions/54671178/how-to-get-the-servername-hostname-in-firebird-2-5-x) – Mark Rotteveel Aug 10 '19 at 05:42
  • "Analyzing the connection string is impossible" - for both you and FB server. You also missed one more possibility - daisy-chaining servers one after another. Using `monitoring tables` you can fetch your connection string by SQL. You can `select * from MON$ATTACHMENTS` but telling local network connection from networked network connection is still up to you, server does not care and does not make much difference. See c:\Program Files\Firebird\Firebird_2_5\doc\README.monitoring_tables.txt – Arioch 'The Aug 11 '19 at 18:36

0 Answers0