0
votes

I have a application which uses Firebird (Version 2.5) database. I wanted to trigger one of the table entry to another database table which is in SQL Server 2008 R2. When I commit I am getting this following error

ErrorCode: 335544569 (ErrorMessage: Dynamic SQL Error SQL error code = -104).

Code:

CREATE TRIGGER "trig_INV"
FOR "INVA"
ACTIVE
AFTER UPDATE
POSITION 100
AS
BEGIN
    IF ((updating) AND ((old.cold <> new.cold))) THEN
    BEGIN
        INSERT INTO 192.168.17.206/1043: [RBT].[dbo].[N_Inv]([COLA], [COLB], [COLC], [COLD], [COLD], [COLE])
            SELECT FIRST 1 
                "COLA", "COLB", "COLC", "COLD", "COLE"  
            FROM "INVA" 
            ORDER BY COLA DESC

END

I am not sure firebird trigger allow to push records to a SQL Server database. It will be great if anyone has tried such and provide some reference. Thanks in advance.

1
"I am not sure firebird trigger allow to push records to a SQL Server database" - no it doesn't. - a_horse_with_no_name
@a_horse_with_no_name,Thanks. Any other method or way to read the record from firebird and push to sqlserver in real time.. I was thinking trigger because its instant. - Mdyahiya
you can write a DLL (UDF) which you would call from the trigger and which will use some external means to communicate with SQL server, this approach potentially has the least latency, but can crash Firebird server (if you make mistakes in DLL, of if your DLL can freeze work for significant time) and would probably be removed in FB4. Better approach would be to POST_EVENT and to have a separate syncronizing applicaiton, which sits connected to both the Firebird and MS-SQL waiting for the FB event, and when it gets it - it scans FB DB for changes and pump them into MS SQL. - Arioch 'The
@Arioch'The, Thanks for your detail feedback. Let me try Post_Event method. - Mdyahiya

1 Answers

0
votes

You get that error because the syntax you're using doesn't exist in Firebird. Firebird has no support to connect to other database systems than Firebird (in theory you could write a provider that allows connecting to other databases systems, but as far as I know, none exist in reality).

If you want to synchronize to a different database system, you will either need to write a UDF or UDR (the replacement of UDFs introduced in Firebird 3) to do this for you, or a custom application that provides synchronization, or use third-party software to do this (for example, SymmetricDS).