Firebird and Interbase Servers Questions (FireDAC)
Go Up to FAQ (FireDAC)
This topic contains a list of questions and answers related to Firebird and Interbase Servers.
Q1: How can I set up a DLL path name for fbclient.dll?
A: The general approach is described in Configuring Drivers. To configure a DLL at run time per application basis, do the following:
If you are going to configure a DLL at design time too, then you should use FDDrivers.ini:
[FB] VendorLib=C:\Program Files\Firebird 2.5\bin\fbclient.dll
Q2: Which DriverName should be used with Firebird 2.5: IB, FB21 or other?
A: FB is the "base" driver ID. FB21 is the "virtual" driver ID. Virtual drivers are configured in the file FDDrivers.ini. There you can see how FB21 is configured. It is the FB base driver configured to use the appropriate fbclient.dll. You can create your own virtual drivers. For example:
[Firebird25] BaseDriverID=FB VendorLib=C:\Program Files\Firebird 2.5\bin\fbclient.dll
Q3: How can I force FireDAC to recognize some field as boolean?
A: A boolean field may be created using a domain. The domain name must contain 'BOOL' substring. Also, add ExtendedMetadata=True parameter to your connection definition. For example:
CREATE DOMAIN T_BOOLEAN SMALLINT; CREATE TABLE ... ( ... BOOLEAN_FIELD T_BOOLEAN, ...);
Q4: How can I force FireDAC to recognize some field as GUID?
A: A GUID field may be created using a domain. The domain name must contain 'GUID' substring. Also, add ExtendedMetadata=True parameter to your connection definition. For example:
CREATE DOMAIN T_GUID AS CHAR(16) CHARACTER SET OCTETS COLLATE OCTETS; CREATE TABLE ... ( ... GUID_FIELD T_GUID, ...);
Q5: Is it possible to drop a Firebird database by SQL?
A: It is not possible with TFDQuery, because DROP DATABASE command is not a FB SQL command, but it is an ISQL command. Instead, specify DropDatabase=Yes in connection definition parameters or use TFDScript with DROP DATABASE command.
Q6: How can I change a user password in Firebird?
A: FireDAC supports password changing in Firebird 2.5 (additionally to Oracle, MySQL, PostgreSQL, SQL Server and SQLite drivers) using the code:
FDConnection1.Connected := True; FDConnection1.ConnectionIntf.ChangePassword('new password');
Q7: How can I mark a database as read-only?
A: Specify in the connection definition parameters:
Q8: It seems that AutoCommit works with Firebird only if FetchOptions.Mode = fmAll, otherwise it does not work at all. Could you please explain how AutoCommit really works?
A: The COMMIT will invalidate all the cursors open in this transaction. FireDAC handles transactions automatically using the following rules:
- If you prepare a command, and there is no active transaction, then it will be started;
- If you explicitly call the Commit method, then all datasets open in this transaction will be brought into Offline state (FetchAll + closing + unpreparing underlying command, but not a dataset itself);
- If the transaction does not have more than an active cursor, then after fetching the last record from this cursor, it will be auto-committed (if requested by option);
- If the transaction does not have any active cursors, then after executing (ExecSQL) command, the transaction will be auto-committed (if requested by option).
There are even more nuances, but the main rules are listed above.
Automatic committing will be issued after the last record is fetched. We cannot change the behavior, so right after Open, FetchAll will be performed and then Commit. There is no difference between fmOnDemand and fmAll.
If you need to make these dataset records, which are changed and posted to the database, visible to the other sessions, while not all records are fetched from the dataset, just use the second update transaction object. So, the cursor transaction will remain active and updates will be executed in the different short transactions. That will make the changes visible to the other users.
Q9: How to connect using an alias?
A: Just set the Protocol parameter to an empty string or do not specify it at all.
Q10: What does "[FireDAC][Phys][FB]connection rejected by remote interface" mean?
A: You are probably connecting to a Firebird server with a FB driver using GDS32.DLL.
Q11: What does "Assertion failure (FireDAC.Phys.IBWrapper.pas, line 2052)" mean?
A: You are probably connecting to an Interbase server with an IB driver using FBCLIENT.DLL.
Q12: What does "no permission for read/select access to TABLE" with FB Embedded mean?
A: Although the security database is not used by the embedded server, it still uses the user name to check rights. If the user name is not specified or is specified incorrectly, you get this error.