Pages

Thursday, 24 September 2015

Basic Firebird Interview Questions and Answers pdf free download

41. Is there an example how to configure UdfAccess setting in firebird.conf?
Well, there’s one right there in the firebird.conf, but perhaps it isn’t obvious enough. Here are the basic settings (‘None’ to disallow UDFs completely and ‘Full’ to allow them anywhere) which you probably understood yourself:
UdfAccess None
UdfAccess = Full
And here is that tricky Restrict setting:
UdfAccess = Restrict C:\some\directory
For multiple directories, use something like this:
UdfAccess = Restrict C:\some\directoryC:’sorne\other\directory
For Linux users:
UdfAccess = Restrict !some/directory
In the default setting ‘Restrict UDF, ‘UDF is a directory relative to root directory of Firebird installation.

42. Is there some bulk load or other way to import a lot of data fast? 
Currently there is only one way to quickly load a lot of data into database. That is by using external tables. You should read the manual for details, but here’s a short explanation. You create a binary or textual file using the external table format and then hook it up in the database using a statement like this:
CREATE TABLE extl EXTERNAL ‘c:\rnyfile.txt’
field I char(20),
field2 smallint
);
To do quick import into regular table, do something like this:
INSERT INTO realtablel (field1, field2)
SELECT field1, field2 FROM ext1;
This insert would still check constraints, foreign keys, fire triggers and build indexes. If you can, it is wise to deactivate indexes and triggers while loading and activate them when done.
Make sure you drop the external table when done, in order to release the lock on the file.
The main problem with external tables is handling of NULLs and BLOBs. If you need to deal with those, you’re better off using some tool like FBExport. However, please note that external tables are much faster.

43. What is the best way to determine whether Firebird server is running? 
If you want to do it from an application, a simple try to connect should suffice. Otherwise you have various options:
a) check if firebird server is in the list of running programs (use task manager on Windows, or ‘ps ax’ command on Linux). Please note that Classic won’t be running until there is a connection established.
b) check whether the port 3050 is open on the machine, First. you can check with netstat command, and if it is open, you can test whether it accepts connections by telnet-ing to the port. Just type:
telnet [hostname|IPaddress] 3050
Example:
telnet localhost 3050
If you use Linux, you can also check the open port with ‘Iso? command. It outputs a lot, so you might want to ‘grep’ for 3050 or gds_db strings:
# lsof |grep gds_db
#Isof grep 3050
c) if all of this fails, perhaps you should check whether the remote server is reachable at all You can use ‘ping’ command:
ping [hostname|IPaddress]
Example:
ping 192.168.0,22
Please note that ping can still give you ‘host unreachable’ message even if host is up. This is because the firewall software can drop the ICMP (ping) packets (it’s done to prevent some viruses from spreading, or network scans).

44. Why does reading require write privileges on database file? 
In order to run the SELECT statement, it still needs to start a transaction.
if you wish to build a read-only database to place on some read-only media like CD or
DVD ROM. you can do it with:
gfix -mode read _only database. fdb
or within your favorite administration tool. ft is also available via ServicesAPl, so you may do it from your application as well. Please note that you can only make this change while preparing the database, because the read-only flag needs to be written in the database file.
When the database becomes read-only, the only thing you can write to is the read_only flag (to reset it back to read-write).

45. How to connect with Firebird database in Delphi using TSQLConnection?

This question is related to Delphi developers. TSQLConnection component is used to connect with firebird in Delphi. Below is code snippet for making firebird database connection in Delphi.

begin
  SQLConnection1.ConnectionName := 'Devart InterBase';
  SQLConnection1.DriverName := 'DevartInterBase';
  SQLConnection1.GetDriverFunc := 'getSQLDriverInterBase';
  SQLConnection1.Params.Values['LibraryName'] := 'dbexpida40.dll';
  SQLConnection1.Params.Values['VendorLib'] := 'fbclient.dll';
  SQLConnection1.Params.Values['HostName'] := 'hostname';
  SQLConnection1.Params.Values['Database'] := 'databasename';
  SQLConnection1.Params.Values['User_Name'] := 'username';
  SQLConnection1.Params.Values['Password'] := 'password';
  SQLConnection1.LoginPrompt := False;
  SQLConnection1.Open;
end;

46. How to tell Firebird to only accept conections from XYZ host or network?
This isn't really a thing you should be configuring in Firebird. There is a RemoteBindAddress setting in firebird.conf which configures on which interfaces/addresses the Firebird listens but that's all. You should really use your system's firewall to set this up.
Beside firewall, if you use Classic on Linux, you can use xinetd or inetd access control files /etc/hosts.allow and /etc/hosts.deny. With xinetd you can also edit the xinetd configuration file for Firebird service, which is in /etc/xinetd.d/firebird and add a line like this:
"only_from = 192.168.0.0/24"

More Questions & Answers:-

No comments:

Post a Comment