Subject Re: [firebird-support] Re: rdb$get_context('SYSTEM', 'CLIENT_ADDRESS') sometimes returns NULL
Author Geoff Worboys
Dmitry Yemanov dimitr@... [firebird-support] wrote:
> 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).

I do have a couple of EXECUTE STATEMENT ON EXTERNAL calls in
the database code. I hadn't given them a thought. In theory
none of them should happen during the startup, but it does
seem the most likely explanation.

Thanks very much for the suggestion. Hopefully, it will be
enough to let me work out what I've done wrong.

--
Geoff Worboys
Telesis Computing Pty Ltd