Can I do multi-database or cross-database queries with Firebird?
Short answer: You cannot. Firebird 2.5 introduces some basic support though...
The only way is to pump the data from one to another using tools like IBDataPump, FBCopy, FBExport, or some of administration tools that have this option. See FAQ #20 for details.
You can, however, do the multi-database transactions: have a one transaction that reads and changes data in multiple database. Firebird's ACID compliant and ensures that this is possible.
Firebird 2.5 introduces a way to query the external data sources in PSQL. EXECUTE STATEMENT has been extended with a special clause: ON EXTERNAL DATA SOURCE, and you can supply a different Firebird database as a data source. This means that you can fetch data from another database into PSQL variables. You cannot do JOINs with tables in different databases, but this is a nice start. Example:
execute block returns (emp_no smallint) as
begin
FOR EXECUTE STATEMENT 'select emp_no from employee'
ON EXTERNAL DATA SOURCE 'localhost:employee' AS USER 'sysdba' PASSWORD 'masterkey'
INTO :emp_no
DO SUSPEND;
end
As you can see, using aliases becomes important and there is still a lot to be desired, but it's enough to cover some of the most basic needs.