In order to run the SELECT statmement, 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. It is also available via ServicesAPI, 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).
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 'lsof' command. It outputs a lot, so you might want to 'grep' for 3050 or gds_db strings:
# lsof | grep gds_db
# lsof | 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).
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 ext1 EXTERNAL 'c:myfile.txt'
(
field1 char(20),
field2 smallint
);
To do quick import into regular table, do something like this:
INSERT INTO realtable1 (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.
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:somedirectory
For multiple directories, use something like this:
UdfAccess = Restrict C:somedirectory;C:someotherdirectory
For Linux users:
UdfAccess = Restrict /some/directory
In the default setting 'Restrict UDF', 'UDF' is a directory relative to root directory of Firebird installation.
Firebird's config file (firebird.conf) does have descriptions inside that explain everything, but sometimes they are confusing and hard to understand what should you do exactly if you don't have examples. One of such settings is ExternalFileAccess. Some people are even tempted to put Full as it is much easier than trying to guess what's the correct format. Here are the basic settings ('None' to disallow external tables and 'Full' to allow them anywhere) which you probably understood yourself:
ExternalFileAccess = None
ExternalFileAccess = Full
And here are those tricky Restrict settings:
ExternalFileAccess = Restrict C:somedirectory
For multiple directories, use something like this:
ExternalFileAccess = Restrict C:somedirectory;C:someotherdirectory
For Linux users:
ExternalFileAccess = Restrict /some/directory
Webmaster 22nd of May 2012
Tell us what you feel about Firebird Interview Questions and Answers
All comments will be published after review. No login or registration is required to post a comment on Firebird Interview Questions and Answers We offer and invite you to submit your valuable comment now; Please be respectful of others when commenting. Insulting others, self-promotional comments, website promotional comments, marketing stuff, SEO Techniques, SMS-style content and off-topic comments will not be approved at this information portal.
So start sharing your thoughts regarding Firebird Interview Questions and Answers
Thank you.