table of contents
|FirebirdEmbedded(3pm)||User Contributed Perl Documentation||FirebirdEmbedded(3pm)|
DBD::FirebirdEmbedded - embedded Firebird server (and client)
use DBI; $dbh = DBI->connect("dbi:FirebirdEmbedded:db=$dbname", undef, undef); # See the DBI module documentation for full details
DBD::FirebirdEmbedded is a variant of DBD::Firebird, linked with the Firebird embedded library, libfbembed. In addition to the ability to work with remote Firebird servers (which DBD::FirebirdEmbedded has, being linked with the Firebird client library, libfbclient), DBD::FirebirdEmbedded can be used to work with Firebird databases without the need of a dedicated Firebird server.
The following things should be set up first:
- These should be unset. Both in the "DBI->connection(...)" call and in the environment ("ISC_USER", "ISC_PASSWORD", "DBI_USER", "DBI_PASSWORD" variables).
- Firebird lock directory
- The "FIREBIRD_LOCK" environment variable should be set to some place where the process can write. Note that if you plan for several processes to access the database file directly, they all should have "FIREBIRD_LOCK" set to the same directory, or else database corruption will occur.
- No "host" in the DSN
- Obviously, do not set any host when calling "DBI->connection(...)", not even "localhost".
- Permissions to read/write the database
- Obviously, the process needs to be able to read/write the database file.
COMPARISON WITH DBD::FIREBIRD¶
DBD::FirebirdEmbedded provides exactly the same functionality as the Firebird server of the same version as the libfbembed library. It still can work with remote datases, in which case the use is exactly the same (DSN, environment) as with the regular DBD::Firebird.
- Standalone work with Firebird databases
- No need to setup/administer a Firebird server. All the server functionality is available via the libfbembed library. Shared access to databases is still possible (but read "Firebird lock directory" above).
- No network latency
- Working directly with the database file eliminates possible network delays (even if the server is on the local host).
- Memory footprint
- The libfbembed library contains a fully functional Firebird server and is therefore bigger than the ordinary client library, libfbclient.
- Setup complexity
- It is very important to make sure that all processes that access a given database use the same lock directory. See "Firebird lock directory" above.