Subject Re: rdb$get_context('SYSTEM', 'CLIENT_ADDRESS') sometimes returns NULL
Author Dmitry Yemanov
21.12.2016 03:45, Geoff Worboys wrote:
>
> Firebird v2.5.6 32bit "Classic"
> on Windows 64bit 2012 R2 Standard
>
> I have an ON CONNECT database trigger in which I try to collect
> the client address and network protocol using:
>
> rdb$get_context('SYSTEM', 'CLIENT_ADDRESS')
> and rdb$get_context('SYSTEM', 'NETWORK_PROTOCOL')
>
> Most of the time they work, but sometimes they return NULL.

Usually this means an embedded connection to the database. While
CLIENT_ADDRESS theoretically could be NULL for network connections, I
can hardly believe this is possible for NETWORK_PROTOCOL which is filled
by the remote server and does not depend on the client in any way.

Even if you don't use fbembed to access that database, it could happen
implicitly on the server side, e.g. if you use EXECUTE STATEMENT ON
EXTERNAL and use a hostless connection string, or if you run
gbak/gstat/gfix via the Services API (they connect embeddedly in this case).


Dmitry