Firebird guys on SQL.ru forum say, that actually it is possible to use Services API to get backup stream remotely.
That does not mean that IBX or UIB or any other library readily support it though. Maybe it does, maybe not.
They suggested to read Release Notes for Firebird 2.5.2 or Part 4 of doc\README.services_extension.txt files of Firebird 2.5.2+ installation.
Below is a small excerpt from the latter:
The simplest way to use this feature is fbsvcmgr. To backup database
run approximately the following:
fbsvcmgr remotehost:service_mgr -user sysdba -password XXX action_backup -dbname some.fdb -bkp_file stdout >some.fbk
and to restore it:
fbsvcmgr remotehost:service_mgr -user sysdba -password XXX action_restore -dbname some.fdb -bkp_file stdin <some.fbk
Please notice - you can't use "verbose" switch when performing backup
because data channel from server to client is used to deliver blocks
of fbk files. You will get appropriate error message if you try to do
it. When restoring database verbose mode may be used without
limitations.
If you want to perform backup/restore from your own program, you
should use services API for it. Backup is very simple - just pass
"stdout"
as backup file name to server and use isc_info_svc_to_eof
in
isc_service_query()
call. Data, returned by repeating calls to
isc_service_query()
(certainly with isc_info_svc_to_eof
tag) is a
stream, representing image of backup file.
Restore is a bit more tricky. Client sends new spb parameter
isc_info_svc_stdin
to server in
isc_service_query()
. If service needs some data in stdin
, it returns
isc_info_svc_stdin
in query results, followed by 4-bytes value -
number of bytes server is ready to accept from client. (0 value means
no more data is needed right now.) The main trick is that client
should NOT send more data than requested by server - this causes an
error "Size of data is more than requested"
. The data is sent in next
isc_service_query()
call in the send_items
block, using
isc_info_svc_line
tag in traditional form: isc_info_svc_line, 2 bytes
length, data
. When the server needs next portion, it once more returns
non-zero isc_info_svc_stdin
value from isc_service_query()
.
A sample of how services API should be used for remote backup and
restore can be found in source code of fbsvcmgr
.