Subject Re: [firebird-support] gbak with servicemanager and filenames with spaces
Author Helen Borrie
At 02:00 PM 11/01/2006 +0000, you wrote:
>i have two problems using gbak with service manager:
>I want to run gbak from a client application to backup a database.
>When the filename (or path) of the database or the backup file contains
>one or more spaces, it doesn't work.
>When i put the filename into quotes, the parameters are send via TCP/IP
>without quotes, and the servicemanager stops interpreting the filename at
>the space.
>When i escape the Space with a backslash (i.e. "/public/Treesoft\
>Office/Data1.fdb"), the firebird server aborts and restarts. The log says:
>fbserver: terminated abnormally (3221225477). In Linux the entry is:
>terminated abnormally (-1).
>The problem occurs on Windows as well as on Linux servers.

I don't think so! For one thing, Linux doesn't allow spaces in pathnames
at all, whether escaped or not. But, in any case, the Firebird API
converts backslashes in paths on Linux into slashes. The problem of spaces
in file paths is going to be encountered on a Windows server.

You can handle it in one of two ways: either use an alias (a valid entry
in the server's firebird.conf) or use the Windows 8-character
convention. So either of the following will work:

1) aliases.conf entry:
empdb = c:\program files\firebird\firebird_1_5\examples\employee.fdb

C:\Program Files\Firebird\Firebird_1_5\bin>gbak -b -se
remserver:service_mgr empdb D:\data\bkp\something.fbk -user sysdba
-password blahblah

or 2)
C:\Program Files\Firebird\Firebird_1_5\bin>gbak -b -se
D:\data\bkp\something1.fbk -user sysdba -password blahblah

>The Version of firebird is is
>Second problem occurs when i run gbak from Windows API CreateProcess.
>There is a obviously uninitialized memory, which is used to pass the
>parameters to the service manager. Thus gbak adds a special character
>(ASCII-Hex E0 or D0) to the last filename.

AFAIK, it's not possible to invoke CreateProcess on a remote server. What
if the remote server were not Windows????

>Thanks for any hint

a) Possibly you don't realise that the service manager runs on the remote
machine, not on the client. So, when you invoke the backup from the remote
client, the gbak program on the client simply connects to the server and
passes parameters to the remote service manager. Then the service manager
calls gbak locally using the passed parameters.

b) Path resolution occurs at the server and has to resolve to a valid path
on the server. For example, if your DB is on a Linux server, it's not
valid to pass a Windows path.

c) You must supply the valid user name and password of either the sysdba
or the database owner for gbak -b, regardless of whether the environment
variables are available on the server.

d) The correct client for the running server must be accessible on both
the remote client and the host machine; and the remote client must use the
correct version of gbak