Subject Re: Identifying whether client library is embedded or normal
Author Helen Borrie
--- In firebird-support@yahoogroups.com, "Adam" <s3057043@...> wrote:
>
> Hi Group,
>
> I have a scenario where I need to know in my delphi application
> whether the embedded dll is in the folder or not. I could not see
any
> version string that could indicate this. I was just going to look at
> the file size and assume it was embedded if it was over 1MB, but I
> thought there may be a better way to do this?
>
> Background: (for those who think the guy is nuts for wanting to try)
>
> The local connection used in Firebird does not work with Terminal
> Services. This means that embedded Firebird can not be used within a
> Terminal Server session. We have some places where the application
> will be used within Terminal Services, and some places where it will
> be run on a normal (2K/XP/etc) box. The application is a stand-alone
> single user application. When it is installed onto a Terminal
Services
> machine, a 'real' (SS or CS) server will need to be installed, and
the
> database will be accessed via a localhost TCP loopback. When it is
run
> on a normal machine, it will be accessed via a local connection
> through the embedded engine (so installing the FB service is
unnecessary).
>
> Basically, my delphi application needs to know whether to insert
> 'localhost:' to the start of the connection string or not.
>
> Thanks
>
> Adam

One possible ploy is to have a "dummy user" for the app when it
connects: one that is allowed to do stuff according to the database
privileges (e.g. define an "all_users" role and assign it to
user "dummy" as well as other legit user[s]). A full server will
reject the user if it doesn't exist in the security database - so
catch this exception and use it to strip out the server element from
the connection string before reconnecting. As long as the role
exists, an embedded server will accept any username.

Depending on how savvy the users are, you might want to loop this a
few times to idiot-proof it from a genuinely dumb login being
requested on a full server.

Other ways are an ini file or a Registry entry that you include in
your installer or that can be set interactively from a small GUI app
that is run afterwards by whatever "responsible" being is installing
the software. That would be my preference, since it covers all
installation possibilities.

./heLen