Firebird execute block where External datasource is localhost
If I understand correctly from your comments, the execute block is executed on the external server, and it needs to query data from the local server.

The problem with your code - as far as I can tell - is that you seem to think the IP addresses are resolved from the perspective of the process initiating the execution (so 127.0.0.1 would be your local database). It is not, address resolution is from the perspective of the process executing the execute block (in this case: the Firebird process on the external server, so 127.0.0.1 is that external server).

You will need to replace 127.0.0.1 with the IP address of the local server for this to work. This IP address should be public, or at least accessible from the external server.

Be aware though, that if you expose both the local and external server to the public internet, that is a security risk. Consider using a VPN to connect between the local and external server(s).