Subject | Re: [firebird-support] execute block where External datasource is localhost :p |
---|---|
Author | Mark Rotteveel |
Post date | 2018-05-09T08:48:09Z |
On 2018-05-08 18:45, Issam Boughanmi amigoface@...
[firebird-support] wrote:
localhost/127.0.0.1 points to the current machine (the machine hosting
Firebird process executing the execute block). If you want to connect
from one database server to another, then using the localhost IP address
in ON EXTERNAL DATASOURCE makes no sense, because that means you are
executing it on the current machine.
So if you want to connect from the external db to your machine, you need
to use the public IP address of your machine (and Firebird needs to be
accessible from the internet, which is not very safe!)
If you want to connect from your machine to the external db, you need to
use the public IP address of the external machine (and again Firebird
needs to be accessible from the internet, which is not very safe!)
In none of those cases would you be using 127.0.0.1.
Mark
[firebird-support] wrote:
> i am writing a little .net application that connect to a remoteAn execute block is executed on the Firebird server, that means
> database server hosted on internet to make a sort of replication .
>
> so the database source live in my local firebird server the
> destination database is on the firebird server hosted on the intenet
>
> here the query
>
> execute block as DECLARE panum INT; DECLARE nom varchar(50); DECLARE
> prenom
> varchar(50); DECLARE dna date; DECLARE datemodif date; DECLARE
> VARIABLE VSQL
> VARCHAR(500); begin VSQL = 'select panum, nom, prenom, dna, DATEMODIF
> from
> patient where (datemodif is not null) and (datediff (day from
> current_date
> to cast(DATEMODIF as date)) >= 0) ';
>
> FOR execute statement VSQL ON EXTERNAL DATA SOURCE
> '127.0.0.1:C:\BDD\D2018.gdb'
> AS USER 'sysdba' PASSWORD 'masterkey' INTO :panum, :nom, :prenom,
> :dna,
> :DATEMODIF DO
>
> merge into patient bb using (select :panum panum, :nom nom, :prenom
> prenom,
> :dna dna, :DATEMODIF datemodif from RDB$DATABASE ) n on bb.panum =
> n.panum
> when matched
> then update set bb.nom = :nom, bb.prenom = :prenom, bb.dna = :DNA,
> bb.DATEMODIF = :DATEMODIF when not matched
> then insert(panum, nom, prenom, dna, datemodif) values(:panum, :nom,
> :prenom, :dna, :datemodif);
>
> suspend; end;
>
> both servers run fb3.0.3 on a windows 64 machines .
>
> but it fail saying that it cannot find the host 127.0.0.1 .
>
> i have also tried localhost and my local ip adress as well .
>
> if i flip the direction so my source database is the remote server and
> the destination is my local server IT WORKS
>
> i know that's a little wierd but i have some constraints for doing it
> like that
localhost/127.0.0.1 points to the current machine (the machine hosting
Firebird process executing the execute block). If you want to connect
from one database server to another, then using the localhost IP address
in ON EXTERNAL DATASOURCE makes no sense, because that means you are
executing it on the current machine.
So if you want to connect from the external db to your machine, you need
to use the public IP address of your machine (and Firebird needs to be
accessible from the internet, which is not very safe!)
If you want to connect from your machine to the external db, you need to
use the public IP address of the external machine (and again Firebird
needs to be accessible from the internet, which is not very safe!)
In none of those cases would you be using 127.0.0.1.
Mark