Subject Re: [firebird-support] Services API with embedded client?
Author Helen Borrie
At 10:47 AM 3/02/2009, you wrote:
>Hey All -
>
>How do I go about using the services API with an embedded server?
>
>The reason I ask is that I need to be able to mark a database created
>by the embedded client as read-only. The API documentation seems to
>suggest that I need to connect to a server - but I don't have one.

This is an interesting question with some issues that I'm wrestling with myself at the moment from a different angle. However, with fbembed.dll or libfbembed.so, you *do* have a server. It's just a non-networked Superserver (on Windows) or Classic process (on non-Windows) that happens to be sharing application space (yours) with a totally dedicated client.

Now, the embedded model on Windows doesn't put the client through server-level authentication so, to that extent, the DPB doesn't need to pass a username and login in order to access the embedded server and any databases it is connected to. However, the server *does* need to know who the user is, because it affects the access privileges to objects in the database.

However, there are *some* operations that can only be initiated by SYSDBA or the Owner of the database it's to be done to ("privileged users") - such as setting the database read-only, setting buffer size, forced writes, etc. You *should* be able to access those database header-level operations through the services manager by supplying the privileged users user name in the SPB (the isc_spb_user_name parameter) and the appropriate spb action, e.g., isc_spb_prp_write_mode for changing this attribute.

Of course, it goes without saying that you can't have both an ordinary user and a privileged user connected simultaneously from your application. Your user interface will have to disconnect the ordinary user and connect the privileged user to do the service task.

Please test it. I'd really like to know how you get on with this.

./heLen