1

I'm writing a .net application that connect to a remote database server hosted on internet to make a sort of replication.

The database source is on my local firebird server, the destination database is on the Firebird server hosted on the internet

This is 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 Firebird 3.0.3 on Windows 64 machines.

It fails with this error message :

Error while trying to open file 12515659 : The system cannot find the path specified. Data source : Firebird::127.0.0.1:C:\BDD\D2018.gdb

I have also tried localhost and my local ip adress as well as server name .

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 weird, but I have some constraints for doing it like this.

  • Cross-posted on firebird-support mailing list: groups.yahoo.com/neo/groups/firebird-support/conversations/… – Mark Rotteveel May 9 '18 at 13:15
  • As I replied on the mailing list, attempting to connect on 127.0.0.1 is a bit odd if you want to connect to another server, and probably not what you should be doing here. – Mark Rotteveel May 9 '18 at 13:16
  • In any case, post the exact error message, and include your attempt that did work. – Mark Rotteveel May 9 '18 at 13:19
  • sorry i have made a mistake when typing in so, there is no double dot in my code . i have edited the question and give the exact errror message – user2475096 May 9 '18 at 16:52
  • That was a reply by someone else on the mailing list, please address the other parts of my comments. The error suggests you can connect, it just can't find the database file (which is not surprising, as I think you are connecting to the wrong server). – Mark Rotteveel May 9 '18 at 17:00
0

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.