Hi,
Dne 03. 07. 22 v 16:10 Steve Naidamast napsal(a):
> Thank you, Mark, for your notes.
>
> What you describe does not appear to be beneficial for developers who want
> to package the Firebird Embedded Database Engine with their applications.
Why not?
> It leads to me to the question as why the Firebird-Driver author would make
> something so simple yet so complex by not using an easily modifiable
> configuration file.
As firebird-driver author, I can ensure you that it's definitely
possible to use "easily modifiable configuration file". However, there
is no predefined configuration file. Instead, you can read the driver
configuration yourself from any configuration file you want (uses
configparser for that).
For example, next code loads driver configuration from file placed in
user-specific conf. directory according to platform-specific directory
scheme.
from pathlib import Path
from firebird.base.config import get_directory_scheme, DirectoryScheme
from firebird.driver import driver_config
APP = 'my_app'
scheme: DirectoryScheme = get_directory_scheme(APP)
driver_conf_file: Path = self.scheme.user_config / 'firebird-driver.conf'
if driver_conf_file.is_file():
driver_config.read(driver_conf_file)
else:
# create config file with default values.
driver_conf_file.write_text(driver_config.get_config())
Loading configuration from CWD is even simpler:
from pathlib import Path
from firebird.driver import driver_config
driver_conf_file: Path = Path.cwd() / 'firebird-driver.conf'
if driver_conf_file.is_file():
driver_config.read(driver_conf_file)
else:
# create config file with default values.
driver_conf_file.write_text(driver_config.get_config())
> In any event, I have tried various uses of the fb_client_library
> configuration, none of which have worked so far...
Why?
You may easily set driver_config.fb_client_library.value to path where
Firebird embedded is installed with your app. Just check how to use
pathlib.Path for that. You may do so directly, or load the configuration
from file, or mix both methods (server+db config from file,
fb_client_library directly).
Just make sure that:
"Important
If you want to use specific Firebird client library, you must set the
value of DriverConfig.fb_client_library configuration option before your
application calls any from following functions: connect(),
create_database(), connect_server(), load_api() or get_api()."
regards
Pavel Cisar
IBPhoenix